5.2 ReferenceError: Can't find variable: isNAN


#1


https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/2?curriculum_id=506324b3a7dffd00020bf661


Hello,

I am stuck on part 2. I am getting the error "ReferenceError: Can't find variable: isNAN". What am I missing? My code looks the same as the lesson.

Thanks,


var isEven = function(number) {
  // Your code goes here!
  if (number % 2 === 0) {
      return true;
  } else if (isNAN(number)){
      return true;
  }
  else { return "isn't number";
  }
};


#2

Supposed so be isNaN.
If number is not a number, you need to return a message instead of true.

You also seem to be missing the case where the number is not even.


#3

Hi,

not isNAN, but isNan. javascript is case-sensitive.

and your else if return is not right as well.

here is mine. hope it can help

var isEven = function(number) {
// Your code goes here!

if(isNaN(number)){
return "that is not a number";
}

else if ( (number % 2) === 0 ){
return true;
}

else{
return false;
}

};

isEven("mama");


#4

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