Syntax as a communication contract
A badly written instruction breaks execution. A well written one removes ambiguity.
JavaScript reads instructions in sequence. If it finds a broken rule such as an open parenthesis, an unclosed brace or an invalid token, it stops the flow and throws an error.
That is why syntax matters twice: first so the engine can run the code, and second so people can read and maintain it.
- Statement: the smallest executable unit.
- Block: a group of statements wrapped in braces.
- Comment: context for humans, not for the runtime.
- Consistent style: fewer reading and review errors.