Could you please review my Show The Local Weather App?

I can’t seem to get my code up and running, even with tutorials! I’ve tried several methods for printing the JS content to html, but it doesn’t register. My error is probably super simple, but if you could point me in the right direction, I’d be super grateful! Cheers!

Hi @xianrusso

Most of the times, errors (shown in the browser console) can give you a pretty good idea what’s wrong with your code.

In your case that’s what you get:

Failed to load resource: the server responded with a status of 401 (Unauthorized)

Pasting the url into the browser directly also can give you some useful info

{"cod":401, "message": "Invalid API key. Please see for more info."}
1 Like

There are a number of problems.

  • You need to use an ES6 precompiler if you’re going to use ES6 syntax. Go to the JavaScript tab in your Pen Settings and under JavaScript Preprocessor, select Babel.

  • The variable url on line 7 needs a keyword

  • url is declared in that function’s scope, so no other function can get to it. That’d be fine if you were returning it as a string, and then calling that function to get the URL, but on line 32 you’re trying to get the variable itself.

  • There’s an authorization issue. Check your OWM key.

1 Like

Thank you! Great tip, I will get in the habit of checking the browser console

Thank you! I don’t fully understand the API and API Key, but I will ask if I have any questions! I appreciate all your help