2. If / Else If / Else issues


#1


My code tells me that the number 3 comes back as true, but actually comes back as "Not a number!" Can someone identify the issue?


var isEven = function(number) {

  if (number % 2 === 0)
  {
      return true;
  }
  else if (isNaN("apple"))
  {
      return "Not a number!";
  }
  else
  {
      return false;
  }
};

isEven(3);


#3

you should check if number is not a number (isNaN)

in case the function is called with an argument which is not a number:

isEven(3);
isEven("apple")

#4

Yes, it worked. Thank you


#5