Created
December 30, 2011 03:21
-
-
Save kingcoyote/1537594 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
var person = function() { // define the blueprint for the person object | |
this.name = ""; // set name and age defaults | |
this.age = ""; | |
}; | |
person.prototype.talk = function() { | |
alert("My name is " + this.name + " and I am " + this.age + " years old."); | |
} | |
var steve = new person(); | |
steve.name = "Steve Phillips"; | |
steve.age = "26"; | |
steve.talk(); | |
var george = new person(); | |
george.name = "George Emond"; | |
george.age = "26"; | |
george.talk(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment