Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Person = function(name) {
- this.name = name;
- };
- // Part 2
- Person.prototype.getName = function() {
- return this.name;
- };
- var thomas = new Person('Thomas');
- var amy = new Person('Amy');
- console.info(thomas.name) // --> "Thomas"
- // Part 3
- console.info(thomas.getName.call(amy)); // Amy
- // Part 4
- delete Person.prototype.getName;
- console.info(thomas.getName); // undefined
- console.info(amy.getName); // undefined
Add Comment
Please, Sign In to add comment