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 Introduction to Programming Control Structures Loops

Extra credit (fizz buzz)

That is what I tried to do, hope it will be nice. Thank you, Marion

for (var counter = 100; counter > 0; counter--) {
  if (counter %5 == 0 && counter %3 == 0) {
    console.log('fizzbuzz');
  } else if (counter %5 == 0) {
    console.log('buzz');
  } else if (counter %3 == 0 ) {
    console.log('fizz');
  } else {
    console.log(counter)
  }
}

3 Answers

Erik McClintock
Erik McClintock
45,783 Points

Looks good, Marion! You can open up the console (in the developer tools of your browser) and paste your code in to see it in action, then you can verify yourself whether or not things are running as you'd expect :)

Keep it up!

Erik

Thanks Erik for your help !

Marion

Michael Bianchi
Michael Bianchi
2,488 Points

<html> <head> <script> for (var i = 1; i < 101; i++){

        if((i % 3 == 0)){
            console.log("fizz")} 
            else if(i % 5 == 0){
                    console.log("buzz");} 
                else {
                console.log(i);}
    }
    </script>
</head>

</html>