Introduction to Objects 1: 3. ...And the good!


#1



ReferenceError: Invalid left-hand side in assignment
Oops, try again. Your code doesn't look quite right. Check the Hint if you need help!


for(var i = 1; i <= 20; i++)
if (i % 3 = 0) {
    console.log("Fizz")
}
else if (i % 5 =0) {
    console.log("Buzz")
}
else if (i % 3 = 0 && i % 5 = 0) {
    console.log("FizzBuzz") 
}
else (i % 3 != 0 || i % 5 != 0) {
    console.log(i)
}


#2

a single equal sign means assign. to compare if something is equal use two equals sign


#3

First of all, you have to compare whether the numbers are exactly divisible by BOTH 3 and 5, so you have to use logic operations && , || and !.
For example,
For 'fizzbuzz' check both like this ((i % 3 === 0 ) && (i % 5 === 0))


#4

else (i % 3 != 0 || i % 5 != 0) {

else should not have a condition. else is the default, so it only operates if everything else doesn't.


#5

to assign use =
to compare use ===
to compare negatively use !==

since IF ELSE statement needs to check/compare condition, change all from line 2 to bottom.


#6

Thank you, after using that I merely needed to combine it with anees5588's reply to get my code right.


#7

Thank you after I did stetim94's reply I did yours and it turned up right.


#8