'else if' in JavaScript is actually a nested 'if' inside an 'else' with optional curly braces omitted
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/if...else#Description
This:
if (condition1)
statement1
else if (condition2)
statement2
else if (condition3)
statement3
Is effectively:
if (condition1)
statement1
else
if (condition2)
statement2
else
if (condition3)
...
Written by Justin H. Johnson
Related protips
1 Response
Hm, I thought this was pretty obvious?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#