I am very new to javascript (and programming in general, for that matter), and I am having difficulty reworking this bit of code:
-
if ((a1 == 'valid') && (a2 == 'valid') && (a3 == 'valid') && (a4 == 'valid')) {
-
// do something
-
}
-
Once I create the array...
-
var theArray = [a1, a2, a3, a4]
-
...how do I loop through and check to see if each object in the array (not just one) is valid? For instance:
-
if (theArray[all] == 'valid') {
-
// do something
-
}
-
I suspect the answer to this question is somewhat rudimentary, but I was unable to find it anywhere else in the forum. Perhaps I am not using the correct terms in my search? In any case, any guidance would be much appreciated.
Thanks,
Matthew