If / else if / else


#1



Part 2 [Thread Title]


SyntaxError: Unexpected token ILLEGAL

On the else if statement, IsNan should return a true value if a string were passed into the function. Since it is saying invalid token, I was unsure. Tried passing a string into the function with no luck. Not sure what is wrong.


var isEven = function(number) {
  if(number % 2 ==0){
    return true;
  }
  else if(isNaN(number)){
      return "H'm, that's not a number!";
  }
  else{
      return false;
  }
  
};


#2

Try refreshing the screen and submitting again. If that doesn't work, is it giving any other info in the error? Link what line it's on? It looks correct to me.


#3

Hey, g. Tried it a little later; it works fine! :slight_smile:


#4

call isEven function outside of your function


#5

It worked fine without calling it. For the record, I did try that to no avail. It must have been a brief hiccup or something; it worked fine, though.

Thank you!


#6

if you don't call the function you get no result...


#7

Quick question: are we supposed to define isNan?


#8

Thanks alot for the clarification