Oops, try again. Your function returns true for 3!


What is wrong?

var isEven = function(number) {
  if(number%2 ===0){
else if (isNaN(number)){
    return"Is not a number"


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


You're also missing the semicolons at the end of your return statements.


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) {
} else {
returns true


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