Question about classes

Good day! Sorry for the stupid question, but I couldn't find the answer. How does the property in the circle differ from those inside the constructor and what is their feature and difference?
No description
2 Replies
Joao
Joao14mo ago
Typically this is done for documenting purposes, although in most cases you want to initialize those values to something which is typically done in the constructor function. But if for whatever reason you don't initialize these values during the instance's constructor, then it should be clear that it does have a property called "name", "surname" or whatever. In recent versions of JavaScript, you can also apply certain access modifiers like "#" to denote it's a private property. Private properties are not accessible from outside of the class.
Eighth
Eighth14mo ago
@joao6246 thank you 🤝
Want results from more Discord servers?
Add your server