2/9 Unexpected token Can't find error


#1

var isEven = function(number) {
if(number % 2 === 0) {
return true;
} else if (isNaN(number); {
return "not a number"
} else {
return false;
}
};
isEven(5);


#2
var isEven = function(number) {
    if (number%2===0){
        return true;
    }
    else if(isNan(number)){
        return "This is a number!";
    }
    else{
        return "This is not a number!";
    }
}

isEven(6);
isNan = true;

#3

Same problem i'm facing too...


#4

Finally it worked for me... here is the code...

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


#5

our problem seems to be the semicolon here:

} else if (isNaN(number); {

#6

What is this isNaN=true in the end? if you rerun your code your isNaN() function will tell you that "true is not a function" because you overwrite it by this. Better delete this line an refresh the page. The rest of the code seems to be ok, although one might think about if it is useful to first check for even numbers and after this for numbers at all.