9.1 More on Control Flow, if/else


#1

I'm not sure why, but it keeps telling me: 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.

my code is
var isEven = function(number) {
// Your code goes here!
if(number%2===0){
return 'True'
}else{
return 'False'
};
};
isEven(30)

Can someone please explain what I'm doinig wrong?


#2

The reason your getting that error is because you're returning 'True' in single quotes. That makes true a string. You want to change that to a Boolean by taking the quotes out.


#3

Also use true and false with lower case starting letters as this is javaScript not Python :wink:


#4

Thank you, I feel stupid now :smile: