Skip to content

Instantly share code, notes, and snippets.

@kingcoyote
Created December 30, 2011 03:21
Show Gist options
  • Save kingcoyote/1537594 to your computer and use it in GitHub Desktop.
Save kingcoyote/1537594 to your computer and use it in GitHub Desktop.
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