Ex2: if/else if/else - syntax error


I am trying to find out what's wrong with my code. Console prints SyntaxError: Syntax error. There is something wrong with your syntax

var isEven = function(number) {
  // Your code goes here!
      return = "You did not enter a number!";
  else if(number % 2 !== 0){
      return false;
  else {
      return true;


I think the order of your if and else if conditions may be wrong... You should have already had a previous code that said
var isEven = function(number) {
if(number % 2 === 0){
return true;
return false

That's all from the previous lesson and it asks you to add onto your code, just asking you to add an else if statement using isNan.


I changed it, but it still shows "syntax error":


Remove the = sign. The equals sign is used as an assignment operator in javascript.


it works. thank you.


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