Statements and declarations
if statement
Evaluates a test for truthiness and executes the consequent when truthy. An optional else handles the falsy outcome. Braces make the branch boundaries explicit.
Formal Syntax & Structure
javascript syntaxjavascript
if (test) { statements }Working Example
Example Snippetjavascript
if (5 > 3) { console.log("yes"); }