Skip to content

Instantly share code, notes, and snippets.

@moose56
Last active June 24, 2018 18:31
Show Gist options
  • Save moose56/a24d447069a8ee7c91d64551543f0538 to your computer and use it in GitHub Desktop.
Save moose56/a24d447069a8ee7c91d64551543f0538 to your computer and use it in GitHub Desktop.
function Person(name) {
this.name = name;
}
Person.prototype.greet = function() {
console.log("Hello, my name is" + this.name);
}
// as of 2015...
class Person {
constructor(name){
this.name = name;
}
greet() {
console.log("Hello, my name is" + this.name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment