i have everything working except the icon (where the icon would change depending on the weather). I used the open Weather’s JSON data, specifically “id”, to determine what icon to use.
var weatherIcon = function(status) {
var icon = “http://openweathermap.org/img/w/”;
console.log(status);
if (status < 300) {
return icon + “11d.png”;
} else if (300 <= status < 500 || 515 < status < 535) {
return icon + “09d.png”;
} else if (500 <= status < 505) {
return icon + “10d.png”;
} else if (status === 511 || 599 < status < 700) {
return icon + “13d.png”;
} else if (700 < status < 800) {
return icon + “50d.png”;
} else if (status === 800) {
return icon + “01d.png”;
} else {
return icon + “03d.png”;
}
}
For my location (seattle), I currently get the id = 801. debugging using console.log shows me that status is indeed 801. However, when it goes through the loop, for some reason, it returns 09d.png, not 03d.png like it should. (Meaning it goes to 300 <= status < 500 || 515 < status <535, which is definitely wrong) What could cause this error in if statement?