I'm not sure how to fix my syntax


#1

var isEven = function(number) {
// Your code goes here!
if(number % 2 === 0)
{ return "string";}
else if(number % 2 === 1)
{return "snookie";}
};

else;{
{return "Not a number.";
}}


#2

This should just be,

    else

There are too many braces; and, we never include semi-colons before or after an else.

Should your returns be true or false?


#3

Now I'm getting an error that it returns true for 3. Why is that an issue? I made an else for non-numbers so why are they concerned with numbers?

var isEven = function(number) {
// Your code goes here!
if(number % 2 === 0)
{ return "string";}
else if(number % 2 === 1)
{return "snookie";}
else{
{return "Not a number.";
}}};


#4

You should probably use ifNaN.

var isEven = function(number) {
// Your code goes here!
if (number % 2 === 0) {
return "string"}
else if (ifNaN(number)) {
return "snookie"
}
else{
return "Not a number.";
}
}


#5

Hi is not ifNaN but isNaN


#6

Ok, thx for the correction.


#7

I'm still getting the same error. They're saying that my function is true for 3