This question already has an answer here:
- IF Statement Always True 3 answers
I have the following code:
console.log(usernameExists);
if (usernameExists = true) {
console.log("returning true");
return true;
} else if (looped = true) {
console.log(usernameExists+" is returned");
looped = null;
return false;
}
The first console.log(usernameExists)
is returning false, but still I am getting a console message of "returning true", and the function in which this is, is returning true! I simply can't figure this out.
Aucun commentaire:
Enregistrer un commentaire