0
At what time we need this parameter...
At what time we need this parameter of the "FOR"?? Can be example please?? for (; i < 10; ) { }
2 Réponses
+ 1
It's the condition to check if we enter the loop or not.
for (var i = 0; i < 10; i++) {
...
}
is equivalent to
var i = 0;
while (i < 10) {
...
i++;
}
0
You will need to use "for" everytime you need to print any information.
Example of a code which search a variable for ofensive words:
var ofensiveWords = ['ofense', 'ofense2', 'ofense3'];
function verifyWords() {
for (i = 0; i < ofensiveWords.length; i++) {
/* HERE GOES THE CODE TO DISPLAY
OR ACT IF A WORD IS OFENSIVE */
}
}