Created
September 3, 2019 20:32
-
-
Save moiz-frost/3b20da0e5a0a694c0a00d42900a851dc to your computer and use it in GitHub Desktop.
Printing this with arrow functions
This file contains hidden or 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
printThis = () => { | |
console.log(this); | |
} | |
var car = { | |
year: 2015, | |
printThis: printThis | |
} | |
printThis(); // will print the global/window object | |
car.printThis(); // will also print the global/window object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment