Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having some trouble with a simple practice.

Heres the code:
var isEven = function(number) {
// Your code goes here!
if(number%2 === 0) {
return true;
} else if(isNaN(number)) {
console.log("This is not a number.");
} else {
return false;
}




};
Posted
Updated 2-Feb-15 13:02pm
v3

1 solution

var isEven = function(number) {
// Your code goes here!
if(number%2 === 0) {
return true;
} else if(isNaN(number)) {
return("This is not a number."); // this had to be return, not console.log
} else {
return false;
}
};
-------------
never mind, got it myself.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900