FizzBuzz in JavaScript
The classic screening exercise for loops and conditionals.
for (let i = 1; i <= 100; i++) {
if (i % 15 === 0) {
console.log("FizzBuzz");
} else if (i % 3 === 0) {
console.log("Fizz");
} else if (i % 5 === 0) {
console.log("Buzz");
} else {
console.log(i);
}
}
Keywords and builtins used here
elseforiflet
The run, in numbers
- Lines
- 11
- Characters to type
- 200
- Tokens
- 79
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 56 seconds.
Step 2 of 3 in Control flow, step 12 of 43 in Language basics.