Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> existential operator,

JavaScript has had this for a bit now and it is really nice.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...



Existential 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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: