What is wrong?

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

What is wrong?

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

It usually makes sense for a function to always return the same type, but I believe that in this case you're meant to return boolean values when the argument is a number.

You should probably also check if it's a number before doing arithmetic operations on it. You could rely on `%`

's behaviour to determine if it's a number or not, but then you shouldn't also be using `isNaN`

I believe I saw somewhere, if either operand is NaN the result is NaN.

This is what I did:

var isEven = function(number) {

// Your code goes here!

if (number % 2 == 0) {

return(true);

} else {

return(false);

};

}

returns true

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.