I've successfully retrieved a promise from this async/await function:
const fetchJSON= (async () => {
const response = await fetch('http://localhost:8081/getJavaMaps')
return await response.json()
})();
Now I want to convert or assign the result to an array. This is what the result looks like in the console.log(fetchJSON):
[[PromiseResult]]: Object
One: "Batman"
Three: "Superman"
Two: "Ironman"
However when I perform operations like: console.log(fetchJSON.One); console.log(fetchJSON.length);
I always get:
undefined
I've tried this:
let myarray = Object.entries(fetchJSON);
But it doesnt convert the PromiseResult Object to 2d arrays.