Function return issue with isNaN()


Hello everyone!
I have been trying to run the code below but I get the following error:
"Oops, try again. Your function returns true for 3!"
I have tried both if/else if/else and the ternary and I still get that same issue. The function returns the right answer every time given different data types but I still get that error. Any assistance would be much appreciated. Thanks!

var isEven = function(n){
    var result = isNaN(n)? "Not a number":(n%2===0? "Even":"Not even")
    return result;



First of all you should always follow the instruction.

read the instruction have to add an else if branch to your existing code.

now come to the point your function should return true for even number and false for not even.

so instead of string value you have to return boolean value.


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