1/14 your function returns false when number = 3


#1

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

then I get this "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."

Isn't this code doing what I want it to by returning "false" when odd numbers are not divisible by 2?


#2

Well you're trying to get "odd" numbers.

so change:

if(number % 2 === 0){
                  ^

to

if(number % 2 === 1){
                  ^

This way you'll get all odd numbers, instead of even numbers.


#3

Judging by the name of the function, isEven, one suspects we would return true if number is even. That would be the goal, but the error message seems to run completely contrary to this.

The sensible approach would be,

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

An odd argument should return false. If the lesson checker won't let this pass, then switch around the return values.


#4

Its the quotes around ("true") and ("false"),it should be return true; and return false;


#6

this was the fix I was looking for, thanks!