Unexpected token )?


Hey can anyone help me with something? I want to know about two things:
First:Can someone tell me what the following code actually does?
Second:It says there's an "unexpected token )", and I do believe it's the closing condition bracket for the else if statement (I ran some experiments to find out) I just don't know how to fix the syntax.

var CoolKids = "HI THERE!";

function India() {
  if (CoolKids % 2 == 0) {
      return true;
  else if ( isNaN(CoolKids); == true ) {
      return "BRO THATS NOT A NUMBER";
  else {
      return false;

unexpected token )


else if ( isNaN(CoolKids); == true )
I would think the unexpected token is simply the semi-colon after the (CoolKids).

Since CoolKids is assigned to a string. Calling the function India:
India (CoolKids);
// will return as "Not a number" Only


Thanks! I still have a few questions though. I was actually trying to focus
on the isNaN syntax because I was just introduced to it. I wanted it to do
this: if isNaN equals true (if the variable India gets detected as no
number) Then you would return "bro that's not a number". Is that the right
syntax for that?
Also, even before I added that semi colon it was showing the "unexpected
token )" thing. Thanks for the help!


Yes I believe it to be correct

In the function India:
If coolkids is not a number (which it is not becuase you have assigned it a value of "Hi there") it will return true and hence it will return return the string "...not a number"

and does this work without that semicolon now? Ive run the exact same code (minus the semicolon) of yours without any errors on my console.


Wow that's awesome! Thanks!


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