Need help in simple if/else? stuck with using function,


#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(isEven % 2) {
return "its evenly devisible";
} else {
return "its not evenly devisible";
}
};
isEven();


#2

On the last line: isEven(); you should call the function with an argument, like this: isEven(3);
The expression isEven % 2 should be number % 2 === 0 - it checks if your argument is even


#5

It does not help the user in any way if you give him the 'finished code'without an explanation. :slight_smile:


#7

If you are referring to the instructions given on the lesson he is on, how would you be helping him/her by just giving the solution?


#8

my bad, thanks 4 ur help...


#9

your condition in if/else should be: number % 2 === 0. It means that condition will be true only if the parameter sent was even number.


#10

thanks i solved it, Appreciated everyone...


#11

A post was split to a new topic: If/else


#12