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; ) { }

22nd Sep 2016, 3:34 PM
Paulo Teixeira Marques
Paulo Teixeira Marques - avatar
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++; }
22nd Sep 2016, 3:49 PM
Zen
Zen - avatar
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 */ } }
22nd Sep 2016, 5:33 PM
Scotti
Scotti - avatar