coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

Proposal: Document Existential Operator Assignment

Open KyleMit opened this issue 1 year ago • 0 comments

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.

KyleMit avatar Apr 15 '23 13:04 KyleMit