6 ms·
> existential operator, JavaScript has had this for a bit now and it is really nice. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operato
by devbent 2y ago
> existential operator,
JavaScript has had this for a bit now and it is really nice.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- mirekrusin 2y agoExistential operator can be used as optional chaining operator but also in trailing position ie: if window? env = 'browser' ... is equivalent to: if (typeof window !== "undefined" && window !== null) { env = 'browser' ... } But yes, nullish coalescing and optional chaining that came from existential operator are good.