javascript for loop iterates block of code a number of times while condition false.
JavaScript for loop syntax:
for (statement 1; statement 2; statement 3)
{
the code block to be executed
}
JavaScript for loop Example:
//Syntax: for (statement 1; statement 2; statement 3) { the code block to be executed } //Example: var x=0; for (var i=0; i<5; i++) { x=x + i; }