JS Statements
JavaScript statements are instructions executed by the browser one by one.
A JavaScript statement is a single instruction for the browser to execute. A program is a series of statements executed top to bottom.
Statements are built from: values, operators, expressions, keywords, and comments.
Try It — Statements in Practice
Preview
Statement Rules
| Rule | Example |
|---|---|
End with semicolon ; | let x = 5; |
| Runs top to bottom | First line → last line |
| White space ignored | let x=5; = let x = 5; |
| Multiple per line | let a=1; let b=2; |
| Can span lines | let msg = "Hello" + " World"; |
Tip: Always add semicolons at the end of statements. While JavaScript can sometimes guess where they go, omitting them can cause hard-to-find bugs.