2. If / else / if / else


#1

I think I have this correct, but I get an error that says "Your function returns true for 3!" Can someone help me please.

var isEven = function(number) {
  // Your code goes here!
  if (number % 2 ===0) {
      return true;
  } else if (isNaN(number) === false) {
      return "Your input is not a number";
  } else {
      return false;
  }

};

#2

Delete this and leave the code as:

else if (isNaN(number)) {
}

#3

We want to work with the return value of the isNaN() function. It will be true if number is not a number.

else if (isNaN(number)) {

}

#4

Thank y'all. I got it and it is working now.


#5

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