Created
July 11, 2019 06:19
-
-
Save vinicius5581/1dfed840af967124aff4b7a4d4ca2bea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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