If / else if / else


#1

//can anyone plz tell me whats wrong with this code.
thanxs

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

};
isEven(3)


#2

The goal here is to check if the the argument(i.e."number") passed is an actual number and nothing else. so you must rather pass "number'' to isNaN() instead.

Also since you are returning your values(which are boolean) the compiler will throw a boolean will give a value back to you the caller but then you want to capture the value an print it on the console to see the result, hence you will have to pass this
call isEven(3) to console.log()


#3

thanx for the feedback