It will have one of the variables defined and the other is defined when you typed if what you typed is the same it has the variable it says correct word and if they are not the same it says an incorrect word. My problem is that always say an incorrect word
function wordcompare() {
var word1 = "word";
var typed = document.getElementById("word");
if (typed === word1) {
alert("Correct word");
} else {
alert("Incorrect word");
}
}
Aucun commentaire:
Enregistrer un commentaire