The idea is to ask the user for a note of the C major scale. The correct answers are ("C" || "D" || "E" || "F" || "G" || "A" ||"B")
. However, regardless of the input, this basic programme always produces the same alert, the one after the "else" statement.
var answ = document.querySelector(".answer");
answ.addEventListener("click", which);
function which() {
var give = document.querySelector(".guess");
if (give === "C" || give === "D" || give === "E" || give === "F" || give === "G" || give === "A" || give === "B") {
alert("Well done!");
console.log(give);
} else {
alert("Wrong!");
}
}
var answ = document.querySelector(".answer");
answ.addEventListener("click", which);