Information Technology IT – 21 Programming for the web | e-Consult
21 Programming for the web (1 questions)
Login to see all questions.
Click on a question to view the answer
for (let i = 1; i
Explanation:
let i = 1;: This initializes a loop counter variableito 1. This happens only once at the beginning of the loop.i :This is the loop condition. The loop continues to execute as long asiis less than or equal to 100.i++: This is the increment statement. After each iteration of the loop, the value ofiis incremented by 1. This happens after every iteration.
The for loop is suitable when the number of iterations is known in advance.