Can somebody help me with this error message


Hello and welcome to the freeCodeCamp community~!

That screenshot is too small to read. Can you share your code (on CodePen, or GitHub), a live version of your app, and the text of the error message?

Hi thank you for the reply. This my code written in codepen.
This is the error :
Uncaught (in promise) TypeError: Cannot read property ‘replace’ of undefined
at setIcons (app.js:36)
at app.js:29
setIcons @ app.js:36
(anonymous) @ app.js:29
Promise.then (async)
(anonymous) @ app.js:21


The error comes from your icon variable being undefined. It looks like you are trying to use object destructuring here:

const {temp, weather, icon} = data.current;

However, the icon property is not in data.current, but in
I am able to access the icon value so:

const {temp, weather} = data.current;
const icon =[0].icon;

This removes the icon.replace error, which should get you moving forward again. :slight_smile:

Yes it worked thank you very much for your clear answer. :smiley: