Skip to content

How does ?? produce mistakes? #2563

@lumosmind

Description

@lumosmind

The limitation is surely debatable, it was added to the language specification with the purpose to avoid programming mistakes, when people start to switch from || to ??.
from: nullish-coalescing-operator

How can it be possible to produce mistake while changing || to ?? . There is not any other operator between their precedence order.

Precedence Operator type Associativity Individual operators
7 Logical AND (&&) left-to-right … && …
-- -- -- --
6 Logical OR (||) left-to-right … || …
5 Nullish coalescing operator (??) left-to-right … ?? …

from : MDN

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions