For Loop
The JavaScript for loop is used to iterate through the array or the elements for a specified number of times. If a certain amount of iteration is known, it should be used.
Syntax:
for (initialization; condition; increment)
{
// code to be executed
}
Example: In this example, we have used for loop.
Javascript
for (let i = 1; i <= 5; i++) { console.log(i); } |
Output
1 2 3 4 5
Contact Us