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


Russell Comer
Russell Comer
26,102 Points

Intro to Programming Control Structures extra Credit

Any one having issues with this portion? I'm trying this but I keep getting an error not sure what syntax I have wrong any help is greatly appreciated!

var counter = 100;
while (counter > 0){
    var mod1 = counter % 3;
    var mod2 = counter % 5;
    if (mod1 == 0, &&  mod2 == 0){

    else (mod1 == 0){

    else (mod2 == 0){

    counter = counter --;

2 Answers

Jeffery Briggette
Jeffery Briggette
Courses Plus Student 5,567 Points

I noticed that you had a comma after the && and it will give you an unexpected '&&'. This is what I came up with after reviewing your code. Hope this helps.

   for (var number = 0; number <= 100; number++){
     var fizz = number % 3;
     var buzz = number % 5;

     if (fizz == 0 && buzz == 0) {
     } else if (buzz == 0 ) {
     } else if (fizz == 0) {
     } else { 

Sorry, the above code is not formatting correctly for some reason. : (

Hey, you should replace your else statements with else if statements, because you cannot test for a condition in an else statement :)

Hope it helps :)