Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function showDetails() {
console.log(this) // { firstName: 'Akash', lastName: 'Rajvanshi' } X 3
console.log(this.firstName, this.lastName) // Akash Rajvanshi x 3
}
var fullName = {
firstName: 'Akash',
lastName: 'Rajvanshi'
}
var exampleOfHardBinding = function () {
showDetails.call(fullName)
} // Hard bounded
exampleOfHardBinding() // 1st Call
setTimeout(exampleOfHardBinding, 100) // 2nd call
// hard bound 'exampleOfHardBinding' can no longer have its 'this' overridden
exampleOfHardBinding.call(window) // 3rd Call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.