Skip to content
JS
JavaScript error

SyntaxError

The JavaScript exception "cannot use ?? unparenthesized within || and && expressions" occurs when a nullish coalescing operator is used with a logical OR or logical AND in the same expression without parentheses.

Reference entryJavaScriptFetched
SyntaxError: Unexpected token '??' (V8-based)
As listed by MDN Web Docs
SyntaxError: cannot use `??` unparenthesized within `||` and `&&` expressions (Firefox)
As listed by MDN Web Docs
SyntaxError: Unexpected token '??'. Coalescing and logical operators used together in the same expression; parentheses must be used to disambiguate. (Safari)
As listed by MDN Web Docs
Category
SyntaxError
Severity
error
Runtime
both
or press Cmd/Ctrl + Enter. The text is only sent to this site to match it.
Source: MDN Web Docs. Data fetched 2026-09-25T01:48:37.273Z.