[Vuejs]-Vue CLI – TypeError: Cannot read properties of undefined (reading '1')

0👍

From what I guess (given the code and the error), there might be an issue with the objects you are receiving from the API.

The error message suggests you are trying to read something from an array at a specific index that is undefined.

The only occurrence in your code that could cause this error is from the template, where you are reading, for example:

{{ forecast.daily[day].dt }}
{{ Math.round(forecast.daily[day].temp.day) }}

I can’t tell exactly which one is it, but try to double check the shape of the objects you are working with.

Leave a comment