2. If / else if / else


#1

Does anyone know what is wrong with my code.

var isEven = function(number) {
if(number % 2 === 0){
return true;
}
else if(isNaN(number)){
return "Input isn't a Number";

     } 
else {
         return "Input isn't a Number";
         }

};
isEven("hello")


#2

else should return false, to indicate the number is not even


#3

like this?

var isEven = function(number) {
if(number % 2 === 0){
return true;
}
else if(isNaN(number)){
return "na";

     } 
else {
         return false;
         }

};
isEven(hello)


#4

the function call:

isEven(hello)

hello is string, so it should have quotation marks around it. It should work


#5

ur missing quotations ..

isEven("hello")