I don't understand what is wrong with my code?


#1

The error is shown as: There was a problem with your syntax.

Here's my code:

var isEven = function(number) {
if(number%2===0)
{
return "Even";
}
else
{
return "Odd";
}
else if(isNaN(number))
{
return "The value entered is not a number";
}
};
isEven(5);


#2

else should always be last, the order is always:

if
else if
else

i would also check if it is a number (isNaN) first, then if it odd or even


#3

Thanks! I figured it out :smile: