Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function showDetails() {
console.log(`My Name is ${this.fullName}`) // My Name is undefined
}
const User = {
fullName: 'Akash Rajvanshi'
}
//call without any .call()/ .apply()/ .bind()
showDetails()
//As we know in simple function "this" refer to the window object
window.fullname = 'Alash Rajavashi'
function showDetails() {
console.log(`My Name is ${this.fullName}`) // My Name is Akash Rajvanshi
}
showDetails()
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.