Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active March 21, 2019 14:13
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 conanak99/9695e3a6469a499854e2 to your computer and use it in GitHub Desktop.
Save conanak99/9695e3a6469a499854e2 to your computer and use it in GitHub Desktop.
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Person.prototype.love = function() { console.log('XXX') };
var otherPerson = new Person('Hoang', 'Pham'); // object này có prototype là Person.prototype
otherPerson.love(); // XXX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment