I'm quite new in this world so I apologise in advance if my question is not completely clear. I'm following an online course and I have this homework but I don't quite understand how to put my object element in my If Statement. After trying for hours I don't even know anymore if what I'm writing makes sense anymore. What I'm trying to achieve is my pop-up using the data from the "user" (which, for this homework, will be fake) to answer with the If statement. `
let weather = {
paris: {
temp: 19.7,
humidity: 80,
},
tokyo: {
temp: 17.3,
humidity: 50,
},
lisbon: {
temp: 30.2,
humidity: 20,
},
"san francisco": {
temp: 20.9,
humidity: 100,
},
oslo: {
temp: -5,
humidity: 20,
},
};
let city = prompt("Enter the city");
city = city.toLowerCase();
city = city.trim();
city = city.replace("sanfrancisco", "san francisco");
if (
city === "tokyo" ||
city === "paris" ||
city === "lisbon" ||
city === "san francisco" ||
city === "oslo"
) {
alert(`It's currently °C (°F) in ${city} with % of humidity.`);
} else {
alert(
"Sorry, we don't know the weather for this city, try going to https://www.google.com/search?q=weather+sydney"
);
}
`
I also need to incorporate Math.round for the temperature but I don't know where to start.