Consider following code snippet:
function Container(param) {
    this.member = param;
    var secret = 3;
    var that = this;
How many private members are in the Class?
This constructor makes three private instance variables: param, secret, and that. They are attached to the object, but they are not accessible to the outside, nor are they accessible to the object's own public methods. They are accessible to private methods. Private methods are inner functions of the constructor.

@mladda21 You are right, but three private variables are: "param" (constructor parameter), "secret" and "that".

2017 Dec 4, 6:39:19 PM

@velibr1278 removed! thanks

2017 Dec 4, 6:29:34 PM

I don't agree with this answer. All variables, which are recorded in "this" are public variables.

2017 Dec 4, 10:28:49 AM

Remove russian language, please

2017 Aug 9, 5:57:52 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes