JavaScript private public privileged access
Public
The members of an object are all public members. There are two ways for putting members in a new object.
In Constructor
In the prototype
This technique is used to add public methods.
Private
Private members are made by the constructor. Ordinary vars and parameters of the constructor become the private members.
Privileged
A privileged method is able to access private methods, variables and is itself accessible to the public method and the outside. Privileged methods are assigned with “this” within the constructor.
References:
Categories :
JavaScript
Programming