No public or private keywords
Hey, I think you have mistaken.
The private keyword is used to hide a method or a property in a class from. To do this in js, you can use
This sort of declaration is what other languages use (notably Java), and implies that access would be done with this.x. Assuming that isn't the case (see below), in JavaScript this would silently create or access a public field, rather than throwing an error. This is a major potential source of bugs or invisibly making public fields which were intended to be private
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ok...
:slight_smile:
I think you mean 😊
Currently at stage-3: MDN: Private class fields
@babel/plugin-proposal-private-met...
Other JavaScript practices: Managing the private data of ES6 classes
TypeScript adoption: ECMAScript Private Fields
Regarding new proposal: why to use
#
instead ofprivate
keyword for the private members? Or am I missing something here?FAQ: