var firstName = 'Hoang', lastName = 'Pham'; | |
// 2 biến này nằm trong object window | |
function showName() | |
{ | |
console.log(this.firstName + ' '+ this.lastName); | |
} | |
window.showName(); // Hoang Pham. this trỏ tới object window | |
showName(); //Hoang Pham. Object gọi hàm showName vẫn là object window |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment