👨‍💻
Learn to Code
  • Welcome
  • HTML
    • The Basics
    • Getting Started
  • JavaScript
    • The Basics
      • Values
      • Variables
      • Functions
      • Operators
      • Conditional Statements
      • Arrays
      • Loops
    • Intro to the DOM
    • Working with the DOM
    • Activities
      • Text Summariser
        • Getting the words
        • Ranking the sentences
        • Getting the summary
      • Greeter Function
      • Fizz Buzz
      • Temperature Converter
Powered by GitBook
On this page

Was this helpful?

  1. JavaScript
  2. Activities

Fizz Buzz

Count from 1 to 50 and print the numbers out:

  • If a number is a multiple of three, print ‘Fizz’.

  • If it’s a multiple of 5, print ‘Buzz’.

  • If it’s a multiple of 3 and 5, print ‘FizzBuzz’.

For everything else, print the number itself. Note: You may wish to use arithmetic operator remainder (%):

PreviousGreeter FunctionNextTemperature Converter

Last updated 5 years ago

Was this helpful?