Classes: private variables

Hey, i don’t really understand the use of private variables inside of classes e.g. #example. Mdn says that it means they can’t legally be referenced outside of the class but isn’t that the default behaviour anyway since it’s defined within the class scope? Thanks in advance
2 Replies
ἔρως
ἔρως4d ago
no, it isnt the default behaviour if you define a property in a class, it is accessible outside of it by default private properties and methods arent
13eck
13eck4d ago
Please keep feature #discussions to the appropriate channel. This channel is for code-specific questions

Did you find this page helpful?