if statement in for loop js code example
Example 1: javascript loop if statement
for (let i = 0; i < 10000; i++) {
console.log('huduiduin 100000 times');
}
Example 2: for of loop syntax javascript
for (let step = 0; step < 5; step++) {
console.log('Walking east one step');
}
Example 3: using if statements in javascript
if (expression) {
Statement(s) to be executed if expression is true
} else {
Statement(s) to be executed if expression is false
}
Example 4: if statements javascript
if (pros < 10) {
console.log("LESS THAN 10 PROS!");
}
else if (pros < 5) {
console.log("LESS THAN 5 PROS!");
}
else {
console.log("How many pros are there?");
}