What's wrong with my syntax?


I don't see the problem with my syntax, but I'm getting a syntax error?

Introduction to 'While' Loops in JS

I've written a for loop and a while loop for the end of this lesson. I can't see anything wrong with the syntax but when I save and submit my code I get the following messages:
"Oops, try again. Your syntax doesn't look quite right. Check the Hint if you need help!"
"ReferenceError: Invalid left-hand side in assignment"
I would appreciate help in finding my error(s).

var rainbows = true
while (rainbows) {
    rainbows = false

for (var i = 1; i < 13; i++) {
    if (i % 2 = 0) {
        console.log(i + " " + "is an even number");
    else {
        console.log(i + " " + "is an odd number");


if (i % 2 = 0) {

we use = for assignment if you want to check whether two values are equal or not use== or ===


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