If / else


#1

Hello all, I feel like this should be super easy! and cant figure out whats wrong with my code, help would be great thanks!

var isEven = function(number) {
if (isEven === 4) {
    return(true);
}
else { return(false);
}
  
};


#2

if (isEven === 4)

why are you checking whether or not isEven equal to 4?

what is isEven?
why did you take number as parameter?


#3

can anyone please tell what’s wrong in this code.

var isEven = function(number) {
if(number%2===0){
return “string”}
else if(!isNaN(number))
{
return"some string"}
else
{
return “yet another string”
}

};
isEven(5);

the error i’m getting is
Oops, try again. Your function returns true for 3!

thanks in advance


#4

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