Created
September 26, 2019 07:18
-
-
Save AkashRajvanshi/a0ee8f5dc08df47ed62052d6406365e9 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
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