var datavals = () =>{
var s = [];
var val = {};
  for (let i = 0; i < query.length; i++) {
    for (let j = 0; j < txnName.length; j++) {
      axios.get(`${BASE_URL}/gsa/${query[i]}/${req.params.id}?txnName=${txnName[j]}`).then(res => {
        val.type = txnName[i]
        val.value = res.data;
        s.push(val)
      }).catch(e=>{console.error(e)});    
    }
  }
  return s;
}
unable to access the value of s outside how to get this value of s or are there any alternatives to write? Also as axios is an async operation I'm getting multiple values not sure how handle multiple axios calls in for-each loops
The query array is of length 6 and txnName is an array of length 8. And when I run the axios call I should ideally get 48 responses along with the txnName added to s[] array which should look something like 
[
{type : 'a1', value: [object]},
{type : 'a2', value: [object]},
...{type : 'a48', value: [object]}
]
where a1...a48 are based on txName items.
When I run my app I'm getting 0 - 500+ items in the array randomly instead of 48 and sometimes app crashes. Also the s[] should be available  res.render('template/page', {data: dataVals()})
