Control flow · Lesson 13 of 45
Challenge: FizzBuzz
The most famous interview question, with conditions and loops.
8 minutes2 games
The task: print the numbers 1 to 15, except:
- multiples of 3 print
Fizzinstead, - multiples of 5 print
Buzz, - multiples of both print
FizzBuzz.
Interviewers love it because it shows whether you understand the order of conditions.
Order the lines
Put the conditions in the right order inside the loop.
- Click the lines in the right order
Exercise
Write FizzBuzz from 1 to 15.
Expected output:
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz
JavaScript
for (let i = 1; i <= 15; i++) {
}
Learn more from
Played 0 of 2 games
Sign in to save your progress and earn XP.