Created
September 28, 2021 20:29
-
-
Save sanskriti-dev/8e65cd5fe40c77dd87b71b183f53f668 to your computer and use it in GitHub Desktop.
Give difference between normal and arrow function -- this instance example
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
let a = () => { | |
console.log(this) | |
} | |
function a2() { | |
console.log(this) | |
} | |
let b = { | |
name:"sanskriti" | |
} | |
a.call(b) // prints window object | |
a2.call(b) // prints b object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment