Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/prototype_add.js Secret

Last active Mar 21, 2019
Embed
What would you like to do?
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