Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Al Lu
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree
Al Lu
UX Design Techdegree Student 15,801 Points

Java script extra credit

"Write a program that loops through the numbers 1 through 100. Each number should be printed to the console, using console.log(). However, if the number is a multiple of 3, don't print the number, instead print the word "fizz". If the number is a multiple of 5, print "buzz" instead of the number. If it is a multiple of 3 and a multiple of 5, print "fizzbuzz" instead of the number." I feel that the extra credit is hard for me. Any websites out there with tutorials about simple stuff like that for someone like me who is new to programming? Thanks

3 Answers

There are many tutorials out there but this type of exercise is best if you can figure it out by experimentation. Take an hour, if not 2. Take as much time as you need.

A good approach for beginner would be to break down the program into manageably small unit tasks, and then figure out which construct to use for each one without looking at the next step.

  1. loops through the number 1 through 100
  2. print each number to the console
  3. if the number is a multiple of 3, print fizz instead
  4. if the number is a multiple of 5, print buzz instead
  5. if the number is a multiple of both, print fizzbuzz
James Barnett
James Barnett
39,199 Points

If you are brand new to programming, you might be interested in getting more practice before you attempt that challenge. You can get some good progress by over at learn street's JavaScript course

Al Lu
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree
Al Lu
UX Design Techdegree Student 15,801 Points

Thanks guys. I'll go with it slow. Its important for me really know and understand JS and not just using free scripts all the time. (which is fine too I guess).