Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsNo—a newline does not automatically end a JavaScript statement. Automatic semicolon insertion (ASI) is a conditional rule in the ECMAScript grammar. It inserts a semicolon only in specified parsing situations, so a line break can end a statement, leave an expression continuing, or make code invalid depending on the tokens around it.
How automatic semicolon insertion works
The ECMAScript 2026 specification says, “Most ECMAScript statements and declarations must be terminated with a semicolon.” It then explains that semicolons may be omitted in certain situations through automatic insertion. ASI is therefore a parser rule, not a formatter that places a semicolon at every newline. See ECMAScript 2026, clause 12.10.
The specification describes three insertion cases:
- Before a token the grammar cannot accept: insertion can occur when that token is separated from the previous token by a line terminator, when the token is a closing brace, or in the specified case where the token follows
)and insertion terminates ado…whilestatement. - At the end of input: a semicolon can be inserted when needed for the parsed goal to be valid.
- Before a restricted token: some grammar productions forbid a line terminator at a particular position. If one occurs there, ASI inserts a semicolon before the restricted token.
These rules depend on the grammar and token sequence. A line terminator may be an ordinary newline, or one contributed by a multiline comment. A single-line comment does not itself change ASI; the line terminator after the comment is what matters.
Line breaks after restricted keywords can change meaning
Some line breaks have specific consequences because the grammar restricts where a line terminator may appear. Keep the keyword and the expression or label it introduces together.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
return: the next line is not returned
function getValue() {
return
{ answer: 42 }
}
The line terminator after return ends the return statement. In this example, the brace begins a separate block, rather than an object being returned, so the function returns undefined. Put the returned expression on the same line as return to make the intent clear:
function getValue() {
return { answer: 42 }
}
throw: a line break before the expression is a syntax error
throw
new Error("failure");
A throw statement requires its expression without a line terminator between throw and that expression. ASI does not turn this into a valid throw statement. Write throw new Error("failure"); on one line.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
break and continue: keep a label on the same line
If a label follows break or continue, a line terminator cannot separate it from the keyword. A newline instead ends the statement without the label, which can alter control flow or make the label appear as a separate expression.
yield, arrows, and async forms
Restricted line breaks also apply to an assignment expression after yield, to arrow parameters and =>, and to tokens following async in async function and method forms. When formatting these constructs, keep the tokens on the required side of the line break; do not assume ASI repairs a split.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Expressions can continue across a newline
A newline does not end an expression when the next token can continue parsing it. For example:
const result = first + second
(third + fourth).print()
The parenthesized expression can be parsed as arguments in a call on the result of first + second. The ECMAScript specification gives the analogous case a = b + c followed by (d + e).print(): it is a continuation, not two independent statements.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Other line starts that can continue what came before include:
(, which can start a call;[, which can start property access;- a template literal, which can be tagged;
- unary
+or-, which can be parsed as a binary operator with the preceding expression; and - a slash-starting expression, which may be parsed as division in context.
If one of these begins a new statement, terminate the preceding statement explicitly or restructure the code so the intended boundary is unambiguous. This is defensive style guidance: it does not mean every statement needs a written semicolon when ASI already applies.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Cases where ASI will not supply a semicolon
It will not create an empty statement
ASI never inserts a semicolon if that would create an empty statement. For example, placing else on a new line does not repair a missing consequent:
if (a > b)
else c = d
This remains invalid; insertion between the if condition and else would create an empty statement.
It will not fill either required separator in a for header
A traditional for header structurally requires two semicolons. ASI will not insert one of those separators to make an incomplete header valid. For example, a line break before ) does not let for (a; b acquire its missing second separator.
Quick Recap
A practical rule for writing and reviewing JavaScript
- Do not treat a newline as a reliable statement boundary.
- Keep
return,throw,break,continue, andyieldwith the expression or label that follows when the grammar requires it. - Check whether a next line starting with
(,[, a template literal,+,-, or a slash could continue the previous expression. - Use an explicit semicolon or clear structural separation when a new statement could otherwise be read as a continuation.
- Remember that some syntax has required separators, such as the two semicolons in a traditional
forheader.
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.

