This code is supposed to give me a very simple output of
the temperture (randomly decided)
the "forecast" (hot, moderate, and cold)
and the clothing for the day
it's giving me the first two but then it's skipping right to valid after that so where am I going wrong with the second else if statement? Also, if anyone has any suggestions to find flaws faster I would love some tips there too!
Thank you in advance!
the temperture (randomly decided)
the "forecast" (hot, moderate, and cold)
and the clothing for the day
it's giving me the first two but then it's skipping right to valid after that so where am I going wrong with the second else if statement? Also, if anyone has any suggestions to find flaws faster I would love some tips there too!
Thank you in advance!
JavaScript:
//create a simple program that will make a clothing decision based on the weather. 1. You need a changing variable for temperture and display it.;
let temp = Math.floor(Math.random() * 30);
console.log(temp);
let forecast = "";
//2. Determine what the forecast is based on that temperture;
if (temp <= 10) {
forecast === "cold";
console.log("cold");
} else if (temp >= 11 && temp <= 20) {
forecast === "moderate";
console.log("moderate")
} else {
forecast === "hot";
console.log("hot");
}
//Determine what to wear based on the forecast
if (forecast === "cold") {
console.log("bundle up!");
} else if (forecast === "moderate") {
console.log("wear a sweater");
} else if (forecast === "hot") {
console.log("sunscreen")
} else {
console.log("invalid")
}