I have the following problem with JavaScript: I have an array with booleans I received from my database and want to do some action if a specific field is true. Because it didn't work I wrote the following:
if(data.participants[i].attended) {
console.log(data.participants[i].attended);
}
In my opinion that should just print 1 or nothing on the console, but -because 0 means false in JS- never 0. But when I let it run it prints 0 on the console.
Aucun commentaire:
Enregistrer un commentaire