I am working on this code, but it won't work

Not sure what I did wrong, but it draws all colors even with the “if”

1 Like

You must use === not =.
= and === is not the same thing. = is used to give ‘‘something’’ a ‘‘value’’ and === is used as the equal you are trying to use.

Hey there, looks like your if statements are using the assignment operator =, instead of the equality operator ===

if (answer = blue) is assigning blue to answer, not checking if they are equal. Same with the other if statements. This is why all of them are running their code.

Try changing = to === and you should get the output you’re looking for.

Hope this helps!
Ben

1 Like

Hey, @CSparks. I see a problem. The problem is: inside the every if statement, you are using assignment operator (=) instead of equality operator (===). Try replace the assignment operator with equality operator.

Hope that helps!
Pummarin