So I have this If statement:
modalEl.addEventListener("click", function (event) {
if (event.target.matches("li")) {
console.log("\"" + questions[questionI].correct + "\"")
console.log(event.target.firstChild)
if (event.target.firstChild === "\"" + questions[questionI].correct + "\"") {
console.log("correct")
} else {
console.log("incorrect")
}
};
});
the console shows that they match. For instance, the first question if you click on the right answer will console.log "8" twice but then it console.logs "incorrect". Why is this happening? Or is there a work around for this?
Aucun commentaire:
Enregistrer un commentaire