Created
January 7, 2016 17:50
-
-
Save conanak99/98fe08437cb042d5d4af to your computer and use it in GitHub Desktop.
This file contains 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
var person = { | |
firstName: 'Hoang', | |
lastName: 'Pham', | |
friends : ['Minh', 'Sang', 'Khoa', 'Hoang'], | |
showFriendFixed: function() { | |
var personObj = this; //Gán giá trị this vào biến personObj | |
this.friends.forEach(function(fr){ | |
console.log(personObj.firstName + ' have a friend named ' + fr); | |
}); | |
} | |
}; | |
person.showFriendFixed(); //Hàm chạy đúng |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment