If/Else strange error?




i have a strage issue with this exercise. because the error message seems to contradict the instructions.

The Instructions say:

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;.

So far so good, but then I get the error message:

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.

So yes, my code outputs FALSE if you enter the number 3, since 3 is not evenly divisible by 2. But thats exactly what the instructions asked me to do, or am I completely lost in translation here?

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



Do not write quotes around boolean primitives.



remove the quotes from true & false


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