Eturns false when number = 3. Check whether your code inside the if/else statement correctly returns true if the number it receives is odd


#1

Instrunctions: Write an if / else statement inside the isEven function. It should return true; if the number it receives is evenly divisible by 2. Otherwise (else), it should return false;.

Error: Oops, try again. Looks like your function returns false when number = 3. Check whether your code inside the if/else statement correctly returns true if the number it receives is odd.

var isEven = function(number) {
// Your code goes here!
var remander = number % 2;
if( number % 2 === 0) {
return "true";
} else {
return "false";
}

};

I might be reading something wrong, help appreciated.


#2

Here try this. I have commented out the errors.

var isEven = function(number) {
                //no need for this line because
                //the variable here is unused
                //var remander = number % 2;
                if( number % 2 === 0) {return true;} //remove quotes arround true and false
                else {return false;}
            };
console.log(isEven(5));
console.log(isEven(6));