2. If/else if/else should work, but


#1

I am getting a "Your code returns true for 3!" except no it doesn't. What's the deal here.


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


#2
else if (isNaN(number)) {
    return "Not a Number";
}

#4

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