I would like to check multiple conditions based on an extensible array of variables. What's the method to check them ?
For example:
a = 0;
b = 1;
c = 0;
if (a == 0 && b == 0 && c == 0) {
console.log("all a,b,c variables == 0")
}
Good. Now for an array ?
arr = ["a", "b", "c", "d", ...];
if (for i = 0; i < arr.length; i ++ { arr[i] == 0 && }) {
console.log("all arr variables == 0")
}
I think I'm going the wrong way here... Is there a solution check a lot of statements based on an array ?
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire