Help needed in 5.1 more on control flow in JS


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-qDwp0/0/1?curriculum_id=506324b3a7dffd00020bf661


Hello,
The current instructions list:
`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;.

Make sure to return - don't use console.log()!`

Though I continue to get this 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. "

What am I doing wrong? Here is my code:


var isEven = function(number) {
  var isEven = (8);
    if(number % 2 === 0 ) {
      return "True";
  } else if (number > 0 ) {
      return "False";
  } else {
      return "False";
  }
  
};


#2

Corrected my own mistake.

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


#3

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