Could I get some help with this project. it's for shecodes, I need it to ask what city and temp when clicking the button and also add a smile or frowny face if temp above 0 and for below 0. Thanks in advance for the help!
<button>Change city</button>
<script>
function changeCity() {
let city = prompt("What city do you live in?");
let temp = prompt("What temperature is it?");
let h1 = document.querySelector("h1");
h1.innerHTML = "Currently " + temp + " in " + city + if (temp > 0)
("😍") else ("😭") ;
}
let weatherButton = document.querySelector("button");
weatherButton.addEventListener("click", changeCity);
Via Active questions tagged javascript - Stack Overflow https://ift.tt/f0PSIYB
Comments
Post a Comment