'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
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#