Statements and declarations
else clause
Provides the alternate branch of an if statement. It runs only when the associated test is falsy. An unbraced else associates with the nearest eligible if.
Formal Syntax & Structure
javascript syntaxjavascript
if (test) { consequent } else { alternate }Working Example
Example Snippetjavascript
if (false) { console.log(1); } else { console.log(2); }