I want there to be more than one if-else statements in one input, when I use this code only how tall is the gateway arch will get an alert and not how tall are the pyramids.
Is this possible anyone?
document.getElementById("button").onclick = function() {
if (document.getElementById("ask").value == "how tall are the pyramids") {
alert("146.5 meters");
} else {
alert("How should I know");
}
}
if (document.getElementById("ask").value == "how tall is the gateway arch") {
alert("630 feet");
} else {
alert("How should I know");
}
}
onclickearly, notice the}after theelse { ... }.