What is the issue w/ my code?


#1



I'm getting the wrong return I believe? I'm not sure. Anything glaring?

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


"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) {
    if (isEven % 2)
    {
        return true;
    }
    else
    {
        return false;
    }
  // Your code goes here!
  
};


#2

There are two problems with your if condition:

if (isEven % 2)

isEven is the function name, i would use the parameter of the function (number) instead. Since you pass numbers into the function, and a function itself never has a remainder.

And you might also want to compare to zero, the reminder of a even number is 0, which is considered false, the remainder of a odd number is 1, which is considered true, so either compare with zero, or swap the return false and return true


#3

Sir, thank god you replied to this!
I've been stuck on this part for a while, so woo, that works!