Skip to content

Instantly share code, notes, and snippets.

@daytonn
Created February 19, 2015 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daytonn/031a34f66b9e43370677 to your computer and use it in GitHub Desktop.
Save daytonn/031a34f66b9e43370677 to your computer and use it in GitHub Desktop.
CWCPOOJS - naive method definition
// DO NOT define instance methods in this way
function Person(attributes) {
this.firstName = attributes.firstName;
this.lastName = attributes.lastName;
this.age = attributes.age;
this.address = attributes.address;
this.sayHello = function() {
console.log("Hi, my name is " + this.firstName + ". I live in " + this.address.city + ", on " + this.address.street + ".")
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment