JS Unit 5.2: More on Flow in JS, please help find error


#1

var isEven = function(number) {
if(number%2===0){
return "It is divisible by 2";

}else if (isNaN(number)){
return"That's not a number";

}else {
return "It is not divisible by 2";
}
}

isEven(3);

This is my code, it gives an error saying "Oops, try again. Your function returns true for 3!" but when I put in 3, it gives me my string saying it's not divisible by 2. I can't figure out why I'm getting an error.


#2

Perhaps the submission test expects booleans to be returned, and interpret your strings as true since they are non-empty?

for (var i = 3; i < 1000; i+=2) {
  if(isEven(i)){
    return "Your function returns true for " + i + "!";
  }
}