jashkenas/coffeescript

Proposal: Document Existential Operator Assignment

KyleMit opened this issue · 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.