# Cannot read property '0' of undefined \[Weather API\]

**URL:** <https://forum.freecodecamp.org/t/cannot-read-property-0-of-undefined-weather-api/179830>\
**Category:** General\
**Created:** [March 15, 2018, 9:50am UTC](https://forum.freecodecamp.org/t/cannot-read-property-0-of-undefined-weather-api/179830 "2018-03-15T09:50:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dement0](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dement0/32/81394_2.png) [@Dement0](https://forum.freecodecamp.org/u/Dement0)\
**Post date:** [March 15, 2018, 9:50am UTC](https://forum.freecodecamp.org/t/cannot-read-property-0-of-undefined-weather-api/179830/1 "2018-03-15T09:50:52Z")

</div>

Hi,

I know that it’s a very basic thing and may seem stupid to ask, but I’m getting this error in my console. I’ve searched for similar errors or questions that people have already asked, read this API Pass-through and other forum posts/solutions but I can’t understand it. I don’t want that somebody would just send me the correct code to solve the thing, I **really** want to understand how to talk with the API. I don’t want to watch a tutorial and copy/paste the thing.

Here is the link of my project - [[https://codepen.io/Dementor-/pen/bvpeVo?editors=1011](https://codepen.io/Dementor-/pen/bvpeVo?editors=1011)]

Thank you for your time for reading this.

---

<div class="post-metadata">

**Author:** ![Dement0](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dement0/32/81394_2.png) [@Dement0](https://forum.freecodecamp.org/u/Dement0)\
**Post date:** [March 15, 2018, 10:45am UTC](https://forum.freecodecamp.org/t/cannot-read-property-0-of-undefined-weather-api/179830/2 "2018-03-15T10:45:28Z")

</div>

So I understand 1 thing that after assigning long and lat values, I needed to assign API URL to the variable inside the function. In this way it can reach long and lat values 😃

Thanks anyway, hope this info helps someone.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:24pm UTC](https://forum.freecodecamp.org/t/cannot-read-property-0-of-undefined-weather-api/179830/3 "2021-01-17T20:24:25Z")

</div>

Closed on January 17, 2021, 8:24pm UTC


