3/13 ...And the good


#1

what's wrong with the code?

for (var x = 1; x <=20; x++){

if ((x % 3 == 0) && (x % 5 == 0)){
    console.log("FizzBuzz");
}else if (x & 5 == 0){
console.log ("Buzz")
}else if (x % 3 == 0){
    console.log ("Fizz");
}else {
    console.log(x);
}

}

it says: You printed 5 when you should have printed Buzz


#2

You have an "&" instead of a "%"


#3

This one worked for me:

for (var i = 1; i <= 20; i++)

if ((i % 3 === 0 && i % 5 === 0)) {
console.log("FizzBuzz");
}

else if (i % 5 === 0) {
console.log("Buzz");
}
else if (i % 3 === 0) {
console.log("Fizz");
}

else {
console.log(i);
}


#4

Your code was helpful. At least i was able to advance.....lol.


#5

Is there a way to do this using _.range(21) { instead of using a for loop? :slight_smile:


#6

It tells me range is not defined when I try to use it. How do I define range to make it usable in this assignment?