I need help with this if/else statement


I'm having trouble understanding what is wrong with my if/else function. When I run it, it prints the wrong answer to the console.

When I run it, it says,"Oops, try again. Looks like your function returns false when number = 2. Check whether your code inside the if/else statement correctly returns true if the number it receives is even."

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


That will be 1 (boolean true) if the value is odd, so should return false.


Thank you, that helped


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