411 REFERENCE · Wikibooks
JavaScript/Reserved words/for
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
JavaScript float function Reserved words 0
The for keyword
The for keyword starts a loop that executes until the condition is met.
Examples
The code
var array = [2, 3, 5, 7, 10, 11], result = 1;
for (var i = 0; i < array.length; i++) {
result += array[i];
console.log("result = " + result);
if (result%2 == 0) {
continue;
}
if (result > 20) {
break;
}
} returns the following: result = 3
result = 6
result = 11
result = 18
result = 28
result = 39
See also
break
continue
JavaScript float function Reserved words 0