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

From https://plainvanillaweb.com/pages/components.html I see this piece:

    if (!this.#span)
What is that kind of magic syntax sugar?! A shorthand for document.getElementById?


No, the hash is a red herring. It's a way of signifying a private field on an object.


Ah. Thanks, that hint pointed me to [1]. Seems like it's been supported by every major browser since 2021, and only specified in the upcoming ECMAScript 2026 spec.

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


It has a contentious history and largely was forced through by one person in TC39 who focused on a particular corner case




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

Search: