Stuck and need help with return - possibly more of my code


What am I doing wrong? Am I logging with return wrong, or is more of my code wrong? I just started this section of the course. Any help would be appreciated :slight_smile:

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

 if (isEven % 2){
     return true
 } else {
     return false

Thanks everyone,


Can you post all of your code so far?


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



the if statement needs a boolean result, you're doing an operation that produces in a number.


You want the if statement to return true and the else statement to return false.

Your if condition should compare the result of number%2 with 0, like this:


Let's pretend number above is 2, it gets divided by 2 and has a remainder of 1. 1 is not equal to 0, so it is false and the else statement would trigger.


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