coderef

Logical assignmentsBaseline · Widely available

The logical AND assignment (&&=) and the logical OR assignment (||=) operators short-circuit the respective binary logical operators.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 16, 2020. Widely available since Mar 16, 2023.

Browser support

DesktopChrome
1–84Not supported
85+Supportedsince Aug 25, 2020
Current: 155
Edge
12–84Not supported
85+Supportedsince Aug 27, 2020
Current: 154
Firefox
1–78Not supported
79+Supportedsince Jul 28, 2020
Current: 157
Safari
1–13.1Not supported
14+Supportedsince Sep 16, 2020
Current: 27
MobileChrome Android
18–84Not supported
85+Supportedsince Aug 25, 2020
Current: 155
Firefox Android
4–68Not supported
79+Supportedsince Jul 28, 2020
Current: 157
Safari iOS
1–13.4Not supported
14+Supportedsince Sep 16, 2020
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: Logical AND assignment.

Feature detection

JS · check before using
// Syntax can't be tested with an if-statement — an unsupported
// browser fails to parse the whole script. Either transpile for older
// targets (e.g. Babel/TypeScript/esbuild), or probe in isolation:
let supported = true;
try {
  new Function("/* code that uses the syntax */");
} catch {
  supported = false;
}

This is a language syntax feature.

Sub-features

Support for each part of the feature (2). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
logical_and_assignment85857914857914
logical_or_assignment85857914857914