Else If (SyntaxError: Unexpected token else)


#1

I always seem to have this issue with else if statements. Every time i get " SyntaxError: Unexpected token else". Can someone please explain why this is? thank you in advance.

var isEven = function(number) {
// Your code goes here!
if (number % 2 === 0){
return true;
}else if (isNaN(number) === true){
return ("This is not a number");
}//closes else if
}else{
return false;
};
};


#2

var isEven = function(number) {
  // Your code goes here!
  if (number % 2 === 0) {
    return true;
  } else if (isNaN(number) === true) {
    return ("This is not a number");
  } else{
    return false;
  }
}

Fixed it. You have one } too many and some ;'s.


#3

Ahh.. thank you very much. i looked over it a dozen times looking for such errors. idk how i missed those.