Optional Chaining (aka Existential Operator, Null Propagation)

Claude Pache claude.pache at gmail.com
Tue Feb 9 07:15:14 UTC 2016


> Le 8 févr. 2016 à 19:58, John Lenz <concavelenz at gmail.com> a écrit :
> 
> If we ever hope to include "elvis".
> 
> obj?:[expr]
> 
> would be roughly equivalent to:
> 
> obj != null ? obj : [expr]
> 
> rather than what you are suggesting here:
> 
> obj != null ? obj[expr] : undefined;

We can always use `??` for that purpose, as do some languages.

However, using the same syntax as an operator (of other languages) with different semantics may be problematic.

—Claude


More information about the es-discuss mailing list