Weather App - Celsius/Fahrenheit Toggle Button Not Working

Weather App - Celsius/Fahrenheit Toggle Button Not Working
0.0 0

#1

Hi everyone,

I’m at the last User Story requirement for the Weather App. I can’t seem to get my C/F degrees toggle button to work. Can anyone please review my code, and if you can assist me in a better solution I would be super grateful. Thank you!

Here is the link to it…

[https://github.com/dennievn/geo_weather/blob/master/weather.js]


#2

You are initializing your toggle like const toggle = false;. Where do you change its value in here? :

           if(toggle == true){
                $("localTemp").html(tempF + "°F");
            } else {
                $("localTemp").html(tempC + "°C");
            }

so if toggle is false all the time you will have executed only the else part all the time.


#3

Another thing. If you define a boolean variable like var myvar = true; then you can only use if(myvar){do something} else {do something else}