Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You should implement the Person prototype which has the following characteristic

ID: 3721100 • Letter: Y

Question

You should implement the Person prototype which has the following characteristics: 1. The name property which is accessible by other objects of this prototype 2. The password property which cannot be accessed by other objects of this prototype 3. The counter property whose value is shared among all objects of this prototype. You need to create two objects of this prototype in order to do the following tasks: 1. Show how to access the name property in both objects. 2. What output do you get if you try to access the password property? How can you correct it? 3. How to access the counter property? If you change the value of the counter property in one object, does it affect the property value on the second object? JavaScript

Explanation / Answer

We can also functions that we share across many objects this way:

//This is how we access the prototype

var o2= Object.create(person);

o1.name(); //Ashu

o2.name(); //Singh

o1.counter(); //12

o2.counter(); //13

//Yes changing the value of counter in one object will affect the value in other object since a reference is made.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote