loading...

re: There's no "else if" in JS VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Isn't the second else supposed to be outside at the same level as the first else? if(){ }else{ if{} }else{ return{} }
 

No, because that would not result in a meaningful execution branch; if we abstract away the code inside the braces we get

if (condition)
{
  foo();
}
else
{
  bar();
}
else
{
  baz();
}

but what would that mean? When would baz() ever be called?

code of conduct - report abuse