If you are new to JavaScript, punctuation can feel arbitrary: when do you need ;, and what do braces {} mean? The key is to separate two questions: ECMAScript defines what code does; a project’s style guide defines how the team chooses to write it. A style convention is not automatically a language rule, but a consistent one makes intent and boundaries easier to see.
Language rules and style rules answer different questions
ECMA-262, the ECMAScript specification, defines the language’s behavior. Its 16th edition was published in June 2025. A style guide, by contrast, recommends conventions for people writing and maintaining code. Airbnb’s JavaScript Style Guide is one example; it is not the specification for JavaScript.
As an Amazon Associate I earn from qualifying purchases.
That distinction matters when a guide says to use semicolons or prefer a particular brace layout. Those recommendations can make a codebase more consistent without being the only valid way to write ECMAScript. Your first practical rule is to follow the conventions of the project you are working in.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Semicolons mark boundaries; newlines do not always do so
ECMAScript has Automatic Semicolon Insertion (ASI): under specified conditions, the language treats a line break as though a semicolon were present. But a newline is not a universal statement terminator. The Airbnb guide explains that JavaScript applies rules to decide whether a line break ends a statement, while ESLint cautions that ASI can lead to unexpected behavior. See the ESLint semi rule.
#1 Best Overall
For example, explicit semicolons make the intended statement boundary visible:
const first = 1;
const second = 2;
A semicolon-omitting style can also be used, but readers and authors must understand where ASI does—and does not—supply a boundary. Do not assume that putting the next expression on a new line always has the same effect as ending the previous statement with a semicolon. Airbnb recommends semicolons; that is a style choice, while ASI is part of the language’s behavior.
Rank #2
Equality conventions reveal what you intend to compare
Airbnb recommends === and !== rather than == and !=. The strict operators compare without the type coercion performed by the loose operators, making the intended comparison more apparent. For instance, 0 === "0" is false, while 0 == "0" is true.
When a value is already meant to be a boolean, test it directly:
if (isReady) {
start();
}
When the condition concerns a string or number, make the test explicit:
if (status === "ready") {
start();
}
These are conventions for making intent easier to read, not a claim that every project must adopt Airbnb’s guide. A team should document its chosen rule and apply it consistently.
Rank #4
Braces make control-flow boundaries visible
Braces group statements into blocks, such as the body of an if statement. Consistent placement helps readers spot where a block begins and ends. ESLint’s brace-style rule allows multiple brace styles and notes that consistency matters for long-term maintainability; it does not declare one style universally better.
For example, a project might place the opening brace on the same line as the condition:
Best Value
if (isReady) {
start();
} else {
wait();
}
Another permitted convention may put the opening brace on the following line. What matters for a team is choosing a layout and avoiding a mix that makes block boundaries harder to scan. Braces are not punctuation to add wherever they look attractive: use them to express the intended block structure in valid ECMAScript.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Agree on conventions and enforce them consistently
A useful team style agreement should answer the practical questions a contributor encounters:
- Whether statements end with explicit semicolons or rely on ASI, and what exceptions are allowed.
- Whether comparisons use strict equality by default.
- Which brace layout the project uses for control-flow blocks.
- Which linter or formatter checks those choices, so enforcement does not depend on individual reviewers spotting every difference.
When joining an existing project, inspect nearby code and its configuration before introducing a different style. In a new project, pick conventions, record them, and configure the tools to match. Treat an exception as a deliberate decision rather than an accidental inconsistency.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




