Skip to content

Instantly share code, notes, and snippets.

@luggage66
Created December 1, 2015 21:46
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 luggage66/9acfdef620f8ebc56748 to your computer and use it in GitHub Desktop.
Save luggage66/9acfdef620f8ebc56748 to your computer and use it in GitHub Desktop.
class MyClass
{
constructor(name) {
this.name = name;
}
printName() {
console.log(this.name);
}
}
var myObject = new MyClass('bob');
myObject.printName();
function MyClass(name) {
this.name = name;
}
MyClass.prototype.printName = function printName() {
console.log(this.name);
}
var myObject = new MyClass('bob');
myObject.printName();
@stefanofiorentino
Copy link

thanks man, I think that's a clear point now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment