Lesson 1, if/else improper use of modulo


#1

Hey, my code is at the bottom, It gives me an error that when number = 2 it returns false. I tried changing the if statement to be isEven % 2 !== 0, and then it said when number = 3 it returns false and it should return true when it's odd? So I'm very confused, if you could help it would be greatly appreciated.

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

#2

I think it's supposed to be

if(number % 2 == 0){

#3

I tried that, i got "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 I'm not sure :confused:


#4

I tried this and got it to work. Hopefully this helps! :smiley:

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