More Control Flow Lesson 2


#1


I'm getting an error telling me that there's a reference error and its possible that I've erased "isEven". I'm not sure what the issue is here. Can someone help?

var isEven = function(number) {
// Your code goes here!
if(number % 2 === 0) {
return(true)
} else if (isNan(number) === false) {
return("Hi"); }
else {
return(false)
}
};
isEven(6);


Replace this line with your code.


#2

The spelling is slightly off... isNaN(). Since the function returns a boolean, we only need to test its truthiness.

else if (isNaN(number)) {
    return "Not a Number";
}

#3

Thanks! got it to work.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.