While Loop in JavaScript
Level 377 keystrokes
This uses a while loop to output the count until it reaches 3.
JavaScript code
// Initialize counter variable to 01let count = 0;// while loop continues as long as condition is true// count < 3 is true when count is 0, 1, or 22while (count < 3) { // Output current count value3 console.log("Count: " + count); // Increment count by 1 (count++ is same as count = count + 1)4 count++;5}Output
Count: 0 Count: 1 Count: 2
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+× 3"× 2(× 2)× 2:× 1.× 1{× 1}× 1<× 1