Having issues with 2.If/ Else If/ Else


2.If/Else if/ Else

I don't understand what is going on. I had my own code, after which I copy pasted another one. It doesn't work. I refreshed about 5 times.

Oops, try again. Your function returns true for 3

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

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

We do not need to compare to a boolean. isNaN() is a boolean. It will be true if number is not a number.


Much obliged sir. Thank you.


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