Having some trouble here and can't seem to find my solution in the other topics


var isEven = function(number) {
  // Your code goes here!
  if (number % 2 === 0) {
      return true
  else if( isNaN) {
      return "Please enter a valid number"
  else if (number % 2 === 1){
      return false;

console.log(isEven(8)); // works
console.log(isEven("j")); //works
console.log(isEven(3)); // <-- "Please enter a valid number"

//"Oops, try again. Your function returns true for 3!"
// When I change to isNaN(number) it tells me "isNaN is not a function"


When I switched the last "else if" to second in the order, it went through. But I'm still confused as to why it wouldn't work as posted.


This should not happen...
Maybe the wrong letters were uppercase....
Try this for your second elif:

  else if (isNaN(number)) {
    return "Is not a number"  

Tell me if it works for you instead of

  else if( isNaN) {
      return "Please enter a valid number"


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