For (begin; condition; step) {
// ... loop body ...
}
Let's learn the meaning of these parts by example. The loop below runs alert(i) for i from 0 up to (but not including) 3.
Syntax
For (let i = 0; i < 3; i++) { // shows 0, then 1, then 2
alert(i);
}