2/9 error


Continuing the discussion from 2/9 - error ....returns false:

 var isEven = function(number) 
       // Your code goes here!
       if(number%2 === 0)
            return "The number is Even Number"; 
      else if(isNaN(number))
           return "not a number"; 
           return "The number is Odd Number"; 

my code, actually it should work, but it is showing the below error..
Oops, try again.
Your function returns true for 3!....
can any one please help me to solve it..


Can you please indent your code


And your else if(isNan(number)) should be
else if (isNaN(number) === true) instead


Your also supposed to be returning booleans i.e(true; false;)


I replaced else if(isNan(number)) with else if (isNaN(number) === true)....but it is showing same error......


Have you changed your return statements from strings to booleans


Your else if statement is fine just your if and else statement's return's need to be true and false not strings


It's working. Thank you so much....


You're welcome. :+1:


But doesn't that do the same thing? If it isn't a number, isNaN is automatically seen as true...


No specifying it makes a big difference .:slight_smile: