I am working on a module in the beginnings of a web development course. I've searched high and low and can't quite find what piece of the puzzle I am missing. The instructions follow as:
Create an if/else if/else statement inside the numberIsEven function for the given num parameter. If the num is even, return true. If the sum is odd, return false.
The code editor has this pulled up to start:
function numberIsEven(sum){
// Check if num is Even, Odd, or Neither
}
This is an example of one of the many things I've tried.
function numberIsEven(sum){
// Check if num is Even, Odd, or Neither
if (sum%2 === 0){
return "True";
} else if (sum%2 !== 0){
return "False";
} else {
return "Neither";
}
}
I keep getting >>undefined when I run my if/else if/else statement. I need to call a variable that will change the function when it's inputed but I'm not sure how to structure the conditional to do so if it's not sum that will determine whether the computer says it's true, false, or neither.
Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire