Hi, Does anyone know if there is a way to allow for 2 correct “if” answers (Warszawa and warszawa) by skipping (else if)?
-
Normal inefficient noob way:
var answer = prompt("What is the capital of Poland?"); if (answer == "Warszawa") {prompt("Exactly"); } else if (answer == "warszawa") {prompt("Almost correct, next time use a Capital letter when writing Warszawa"); } else {prompt("Wrong, the correct answer is Warszawa"); }
-
This is my unsuccessful idea:
var answer = prompt(“What is the capital of Poland?”);
if (answer == “Warszawa” || “warszawa”) {prompt(“Exactly”);
}
else {prompt(“Wrong, the correct answer is Warszawa”);
}