The for loop is used when you know in advance how many times the script should run.
code to be executed
document.write(“The number is” +i)
The above example defines a loop that starts with i=0. The loop will continue to run as long as i is less than, or equal to 10. i will increase by 1 each time the loop runs.