I’m doing some JavaScript self-study, trying to check if n is anything other than a number in the third if of the factorial function, but I can’t get it to work. Any help would be appreciated
var factorial = function(n) {
// Update so that all tests pass
if (n > 20) {
return undefined;
}
if (n === 1) {
return 1;
}
if(isNan(n)){
return undefined;
}
return n * factorial(n-1);
};
isNaN()has two capitalNs.