This seems correct to me, but 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."


#1

here is my code:

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

Thank you for your time, and any help anyone might have is greatly appreciated.


#2

you will want to replace

with

(number % 2 == 0)

First off, you have the number parameter that your function is called with, use it :slightly_smiling: . This means that when I call your function with my new code

isEven(2);

the function will replace the placeholder number and put the 2 in it's place like so

if(2 % 2 == 0)

Second, the module(%) checks for remainders. If the number is even you want as many twos you can put into that number and get out 0 remainder. 8 % 2 == 0, 7 % 2 == 1.

so to check if a number is even use

number % 2 == 0;

to check if a number is odd use

number % 2 == 1;

Hope that helps :sunny:

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Oh and just for fun I will give you an alternate way to write a function in JavaScript :slightly_smiling: .

instead of this

var isEven = function(number) {

you can just write

function isEven(number){

:sheep:


#3

That was REALLY helpful! Thanks for your time!