Basic For Loop in JavaScript
Level 252 keystrokes
A for loop iterates a specific number of times with a counter variable.
JavaScript code
// for loop: initialize i=1, continue while i<=3, increment after each iteration1for (let i = 1; i <= 3; i++) { // Output i multiplied by 2 (2, 4, 6)2 console.log(i * 2);3}Output
2 4 6
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
;× 3(× 2)× 2+× 2=× 2.× 1{× 1}× 1*× 1<× 1