What is wrong with my code please?

#1

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.

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

};
isEven(20);``````

#2

@mjeeezyy,
Javascript has the so-called Remainder-operator %
is actually a modulo-operator
and if used it will return the rest-value.

9%3 You read it as nine modulo three is zero, as 9 divided by 3 has NO rest-value.
22%6 You read 22 modulo six is 4, as 22 divided by 6 will leave you with rest-value 4
10%5 You read 10 nodulo five is zero, as 10 divided by 5 will have NO rest-value

Thus if you use
number%2 === 0
then you know that the number is an Even number.....
and you then use
return true

You can express a Boolean Value with true or false

#3

If you put the number value as 20, and then you made it go to return "False", then it will return false, rather then true, unless I'm misunderstanding what you need to do in the exercise

#4

Then what do I need to do in order to make it "True" ?

#5

How do I get my code to return "True" rather than "False"

#6

@mjeeezyy,