It is similar to For Loop in any other programming language like JAVA, C++ or PHP
As you can see above, Variable "numbers" is declared to store 4 numbers.
For Loop is than used to iterate over this numbers and in each iteration the number is accessed from the array with current index and checked in if statement.
If number is divisible by 2, than one alert statement is used. If it is not divisible by 2 than other alert statement in ELSE block is used to display message on browser.
For Loop contains 3 parts. Each is separated by semicolon(;)
First part declares the variable for current iteration with its initial value. For example in the above statement, var i=0 is declaring the variable i for current iteration and its initial value is set to 0. In each iteration, the value will be changed.
Second part declares the condition for the iteration to continuer. Iteration will continue till the condition in this part is evaluated as true. For example in the above statement, iterations will continue till the value of i is less than the length of array numbers. Since the length of array numbers is 4 in this case, iterations will continue till the value of i becomes 3. When value of i becomes 4, iterations will stop as condition evaluation will return false when i becomes 4 (4 < 4).
Third part can be optional. It can be any statement. In the example above, the statement is to increment the value of current iteration index by 1.
Try different values and see how it works. That will help you to understand for loop in more detail.