试用此代码
var isEven = function(number) {
if (number % 2 === 0) {
return true;
} else if (isNaN(number)) {
return "Not a number";
} else {
return false;
}
}
isEven();
这一定对你有用。我得到这个正确!!!!
答案 0 :(得分:2)
您获得ReferenceError
,因为没有isNan
功能。它被称为isNaN
。
答案 1 :(得分:0)
var isEven = function(number) {
if (number % 2 === 0) {
return true;
} else if (NaN(number)) {
return "Your input is not a number!";
} else {
return false;
}
};
答案 2 :(得分:0)
var isEven = function(number) {
// Your code goes here!
if(number%2){
return true;
}
else if(isNan (number)){
return "Your input is not a number.";
}
else{
return false;
}
};`enter code here`
答案 3 :(得分:0)
检查出来:
var isEven = function(number) {
if (isNaN (number)) {
return "The input was not a number!";
}
else if (number % 2 === 0) {
return true;
}
else if (isNaN (number) === true) {
return "Your input isn't a number!";
}
else {
return false;
}
};