Intro to objects (Debug Needed)


for (i=0; i<21; i++) {
    if(i === 3/) { 
    }else if (i === 5/){
    }else if (i === 3/, i === 5/) {


There is quite a few things wrong here.

Firstly you need to console.log fizzbuzz first before you check if 5 and 3 are divisible by the number.

Secondly this is will cause a syntax error. You are meant to use the symbol % when checking if numbers are divisible. Instead you need to do this

num % 3 === 0

And finally why is there a comma here? Shouldn't it be &&?


Oh yeah. Sorry, it's been a while since I have done math in java.
It works better now, but it won't print "FizzBuzz"


Thank you for your help again, by the way.


Most welcome. So your first if needs to check for fizzbuzz, it should look like this. Remembering that you should check for the lower of the two numbers first.

if (i % 3 === 0 && i % 5 === 0)


if that doesn't work please past your updated code.


It worked. Thank you!


How would this be fixed? It's in the very next lesson.

var getReview = function (movie) {
case (movie === "Toy Story 2"):
return("Great story. Mean prospector.");
case (movie === "Finding Nemo"):
return("Cool animation, and funny turtles.");
case (movie === "The Lion King."):
return("Great songs.");
return("I don't know!");


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.