Skip to content

Instantly share code, notes, and snippets.

@mstarkman
Created August 9, 2011 17:21
Show Gist options
  • Save mstarkman/1134634 to your computer and use it in GitHub Desktop.
Save mstarkman/1134634 to your computer and use it in GitHub Desktop.
JavaScript Masters Class - Exercise 8
// 1.
function Person(name) {
this.name = name;
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
console.log(thomas.name);
// 2.
Person.prototype.getName = function() {
return this.name;
}
console.log(thomas.getName());
// 3.
thomas.getName = function() {
return amy.getName();
}
console.log(thomas.getName());
// 4.
delete Person.prototype.getName;
console.log(thomas.getName());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment