How to add isNaN in if/else branch


#1


var isEven = function(number) {
  if(number%2 === 0){
      return true
  }
  else if(isNaN(number)){
      return "Input is not a number!!!"
  else{
      return false
  }
};
isEven(3)

Replace this line with your code.


#2

It showed a syntax error............
but it sorted somehow when I re-put these codes in the playground....................


#3

A semicolon missing. Code :
var isEven = function(number) {
if(number%2 === 0){
return true;
}
else if(isNaN(number)){
return "Input is not a number!!!"}
else {
return false;
}
};
isEven(3)


#4

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