Okay, I have searched far and wide. I can't figure out why my array.push gives me [] and not (#) {...}, {...}, {...}, etc. Here is my relevant code:
let newArray = [];
const fetchAll = async (urls) => {
const res = await Promise.all(urls.map(u => fetch(u)))
const jsons = await Promise.all(res.map(r => r.json()))
for (let i = 0; i < jsons.length; i++) {
for (let j = 0; j < 2; j++) {
newArray.push({
'img': jsons[i].hits[j].previewURL
});
}
}
}
Like I said, I specifically want the array to output like (#) {...}, {...}, {...} etc. Right now I'm just getting [ ]. With the array.
For reference: I want my array to look like the bottom console.log. The top is what I'm getting.