I'm using Promise.all() for the first time, hopefully, this isn't too ignorant...
I'm unable to access my array with dot notation or bracket notation. I have two objects in the array, each with a key of 0 and then 1.
I get undefined when I try using indices and bracket notation.
Here is an image of it all...
I'm using Promise.all() for the first time, hopefully, this isn't too ignorant...
// GET ALL POKEMON NAMES
let fetchAll = fetch(`https://pokeapi.co/api/v2/pokemon/?
limit=20&offset=0`);
let fetchEach = fetch("https://pokeapi.co/api/v2/pokemon/1");
let dataArr = []
Promise.all([fetchAll, fetchEach])
.then(files => files.forEach(file => process(file.json())))
.then(console.log(dataArr[1].abilities))
.catch(err => console.log(err))
let process = (prom) => {
prom.then(data => dataArr.push(data))
}
I expect to be able to grab the object in the array but only get undefined.