Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var person = {
firstName: 'Hoang',
lastName: 'Pham',
showName: function() {
console.log(this.firstName + ' ' + this.lastName);
//Ở đây this sẽ là object person
person.showName(); //Hoang Pham.
$('button').click(person.showName); //showName truyền vào như callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment