The KIRUPA orange logo! A stylized orange made to look like a glass of orange juice! Tutorials Books Videos Forums

Customize Theme




Table of Contents


by kirupa   |   filed under Coding Exercises

Some coding exercises are so popular and legendary, they are the primary topic of watercoolers, sports bars, and family dinners. One such exercise is FizzBuzz. The rules of FizzBuzz are as follows:

  1. We want to print each number from 1 to 100
  2. For any number that is a multiple of 3, we print the word Fizz instead of the number
  3. For any number that is a multiple of 5, we print the word Buzz instead
  4. For any number that is a multiple of both 3 and 5, we print the word FizzBuzz

An example of output here could be:


The exercise is to turn these rules into some sweet SWEET JavaScript code that prints the proper output to the Console for numbers starting at 1 and going all the way to 100.


Hint: Some Learning Resources and Getting Help

The following tutorials may provide some helpful tips and techniques to help you with this exercise: Console Logging Basics, If/Else Statements,Looping in JavaScript, Numbers

We want to make this a fun learning activity. If you are stuck and need help, please ask on the forums. Please explain your problem in detail and one of the many helpful forum members will help you out.

Getting Your Badge

Once you have completed this exercise, you have earned the awesome bragworthy privilege of adding the following badge to your collection:

To claim it, head over to the forums and respond in the FizzBuzz topic. Be sure to include a link to your solution or insert a copy of your HTML/CSS/JS in the body of the message. Once you have created your topic, Kirupa will give you a virtual high-five and ensure this badge is added to your list of assigned badges.

One Possible Solution

If you want to see one way of solving this, check out Kirupa's video below:

There are many solutions possible, so don't worry if your working solution looks different. If it is different, do share it on the forums and the community as a whole will benefit from your creative solution!

Just a final word before we wrap up. If you have a question and/or want to be part of a friendly, collaborative community of over 220k other developers like yourself, post on the forums for a quick response!

Kirupa's signature!

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!


Serving you freshly baked content since 1998!
Killer icons by Dark Project Studios

Twitter Youtube Facebook Pinterest Instagram Github