Skip to content

Instantly share code, notes, and snippets.

@aaronpowell
Created August 14, 2011 22:52
Show Gist options
  • Save aaronpowell/1145416 to your computer and use it in GitHub Desktop.
Save aaronpowell/1145416 to your computer and use it in GitHub Desktop.
Q6 - What's old is new
var Person = function(name) {
this.name = name;
}
Person.prototype.sayHello = function() {
console.log('Hello, my name is ' + this.name);
}
var aaron = Person('Aaron');
aaron.sayHello();
var john = new Person('John');
john.sayHello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment