2. Oops, try again. It looks like you didn't include your else if() branch


#1


2. if/else if/else


Oops, try again. It looks like you didn't include your else if() branch.
I think my code is working fine.


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

isEven('k');


#3

But instruction says to add if/elseif/else statement:

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

isEven('k');

#4

Thanks, I got it.
Seems I didn't understand the question.


#5

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