How to use JSON on glitch static website

I am struggling to transform a JSON array into something readable by JavaScript. I used the fetch API and the parse method. When I console.log the output, it gives me a JSON array, but when I tell the script to extract a certain value from a key in the array, it claims that it can’t extract values from null or undefined. What is happening and how do I fix this complication?

Here is my code.

1 Like

Never mind, found the answer by myself. Turns out that the variable ‘out’ is only used inside of the function .then(out). And you cant use variables declared by a function outside the same function.

4 Likes