in my pen, none of the console.log statements are working. I guess theres some issue with the location function. Any help will be appreciated.
This is a common problem with Chrome and Openweathermap.
Chrome will only let you get a location over https whereas openweathermap only lets you communicate over http - so the two don’t play that nicely together.
The linked post below shows some previous discussion of this issue, and some solutions others have used:
You can use this api to extract the coordinates. Not sure if works on all browsers, but it works on chrome.