by devbent · 2y ago · 0 comments
JavaScript has had this for a bit now and it is really nice.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
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.