79143724

Date: 2024-10-31 07:00:14
Score: 0.5
Natty:
Report link

I guess it's because Symbol is used to create unique identifiers to avoid attribute name conflicts in the future.
And true #private field is accessible only from within the class in which it is declared, also true #private field actually not a property to this(this in instanceMethod or staticMethod), as MDN page - Private properties says:

The privacy encapsulation of these class properties is enforced by JavaScript itself.

Thus you have no reason to use Symbol to declare private fileds, hash notation #privateField just wouldn't cause attribute name conflicts in the future, since you can't access #privateField out of the class where you declared it.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Lucas