Statements and declarations
else if chain
An else clause containing another if. Conditions are considered in source order; a selected branch prevents evaluation of later conditions in that chain.
Formal Syntax & Structure
javascript syntaxjavascript
if (a) { first } else if (b) { second }Working Example
Example Snippetjavascript
if (false) { console.log(1); } else if (true) { console.log(2); }