April 2018
Beginner
536 pages
13h 21m
English
The for statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement or a set of statements executed in the loop:
for (let i: number = 0; i < 9; i++) {
console.log(i);
}
The preceding code snippet contains a for statement. It starts by declaring the variable i and initializing it to 0. It checks whether i is less than 9, performs the two succeeding statements, and increments i by one after each pass through the loop.