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);
var showNameFunc = person.showName.bind(person); //Gán function vào biến showNameFunc
showNameFunc(); //Chạy đúng vì this bây giờ là object person, do ta đã bind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment