It is saying I have a syntax error. Please help! 2/14 Control Flow


#1



var isEven = function(number) {
if (number%2 === 0) {
    return true;
}
else if {
    isNaN(number) === true;
    console.log("That is not a number, sorry!");
}
else {
    return false;
}
  
};


#2

I fixed it, I had to put the ' isNaN(number) === true;' into () after the else if, before the { }


#3

The error messages are quite a bit shorter than they should be, I suggest that if you get other error messages like that, that you run your code in a different js interpreter.

For example:

$ xsel > nitengale.js  # copy your code to a file
$ node nitengale.js    # run said file with nodejs
/tmp/js/nitengale.js:5
else if {
        ^
SyntaxError: Unexpected token {

That's quite a bit more informative, right?