Skip to content

Instantly share code, notes, and snippets.

@vinicius5581
Created July 11, 2019 06:19
Show Gist options
  • Save vinicius5581/1dfed840af967124aff4b7a4d4ca2bea to your computer and use it in GitHub Desktop.
Save vinicius5581/1dfed840af967124aff4b7a4d4ca2bea to your computer and use it in GitHub Desktop.
const p1 = {
name: 'p1',
sayHi: function(){console.log('hi')}
}
function Person(name) {
this.name = name;
this.sayHi = function(){console.log('hi')};
}
const p4 = new Person('p4');
const BetterPerson = function BetterPerson(name) {
this.name = name;
}
BetterPerson.prototype.sayHi = function(){console.log('hi')};
BetterPerson.prototype.age = 20;
const p7 = new BetterPerson('p7');
const p8 = new BetterPerson('p8');
console.dir(p7);
console.dir(p8);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment