Control Flow - "if / else if / else" using isNan


Hi all,

I'm getting the following error when I submit this code: SyntaxError: expected expression, got keyword 'else'

I'm slightly pulling my hair out because I can't see what's wrong. Can anyone else see what's missing? This is the code I'm running:

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

    else {
        return false;




...And I literally just worked it out! I removed semi-colons after each if / else if statement. Doh!


The problem is not about missing but about having too much :slightly_smiling: in this case semicolons in your conditional structure. Have a look at this for a longer explanation:


Yep, all sorted now. Thanks for your prompt help!