Why won't this work?


#1


https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/1?curriculum_id=506324b3a7dffd00020bf661#


-Oops, try again. It looks like you have a ReferenceError. Maybe you forgot to define a function named isEven?
-ReferenceError: isEven is not defined
-ReferenceError: Invalid left-hand side in assignment


var isEven = function(number) {
  if(number % 2 = 0) {
    return true; 
  }
 else {
    return false;   
  }
};


#2

if(number % 2 = 0)

You need to add another equal sign here making it look like this.

if(number % 2 == 0)

This is because you are comparing rather than assigning.

Let me know if that worked and if you need further explanation.


#3

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