Skip to content

Proposal: Document Existential Operator Assignment #5446

@KyleMit

Description

@KyleMit

In a divergence from the way optional chaining works in JS, CoffeeScript allows the existential operator on the left half of an assignment, whereas as JS does not.

You can see an example of this in the following code:

// input
el?.href = "b"

// output
if (el != null) {
  el.href = "b";
}

However, I don't see this documented anyway in the Existential Operator section in the docs

Since it's different from the EcmaScript implementation, it might be helpful to officially list in in CoffeeScripts docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions