If / else if / else


#1

Hey.. can enyone explain me, why my code doesn't work?

var isEven = function(number) {
if(number%2 === 0) {return "Number is divisibly by 2";}
else if(isNaN(number))
{ return "It's not a number!";}
else {return "Number is not divisible by 2";}
// Your code goes here!

};
isEven("Christian");

I always get this one: "Oops, try again. Your function returns true for 3!"

thanks for your help!


#2

because you should return boolean values if the number is divisible by 2 return true, if not, return false


#3

omg.. I didn't know I am that stupid ..:confused:
thank You!!


#4

It should be in the instructions, go look and see if you can find it


#5

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