I'm trying to call a function in loop and function doing some https request the response is returning back to function and it returns :
{"_U": 0, "_V": 0, "_W": null, "_X": null}
I want to return the exact value to that key where the function is called in the loop.
Here is my code :
res.forEach(async (elem, index) => {
await arr.push({
id: index,
name: '',
color: '#2F14A8',
chain: elem.chain,
address: elem.walletAddress,
balance: getWalletBalance(elem.walletAddress), //<---- **function call**
img: images[index % images.length],
});
});
Here is the function :
const getWalletBalance =async address => {
let tokensArr=[] // some arry
const res = await dispatch(getBalanc(address, tokensArr));
return res;
}