i have this simple code to get some objects from api and add it to an array
const res = await fetch("http://localhost:5000/cart/carts/"+this.state.user);
const data = await res.json();
let data1 = [];
data.forEach(async item => {
const res1 = await fetch("http://localhost:5000/storemanger/products/"+item.product);
const object = await res1.json();
data1.push(object);
});
console.log(data1)
output of console log
but if try to access first element like
console.log(data1[0])
output is "undefined "
i want to access the productname of objects inside the array