Created
August 9, 2011 17:21
-
-
Save bishopgrutty/1134637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step 1 | |
var Person = function (name) { | |
this.name = name; | |
} | |
var thomas = new Person('Thomas'); | |
var amy = new Person('Amy'); | |
console.log("thomas.name: ",thomas.name); | |
//Step 2 | |
Person.prototype.getName = function () { | |
return this.name; | |
} | |
console.log("thomas.getName(): ",thomas.getName()); | |
//Step 3 | |
console.log("thomas.getName.call(amy): ",thomas.getName.call(amy)); | |
//Step 4 | |
console.log("getName in Thomas: ",'getName' in thomas); | |
delete Person.prototype.getName; | |
console.log("getName in Thomas: ",'getName' in thomas); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment