2. If / else if / else


var isEven = function(number) {

    if (number % 2 === 0) {
    return true;
    else if (isNaN(NaN) === false) {
    return "That ain't a number!";
    else {
    return false;

I need help why this is wrong, "Oops, try again. Make sure your if/else if/else statement returns a string when the function input isn't a number."



isNaN(var) returns True if var is not a number and returns False when it is a number. So you got that definition reversed.
Also, NaN is not a defined variable (where did you define it?). Your input is number and you need to validate if that is a number of not.


i appreciate ur contribution to me accomploshing my work


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