Created
October 30, 2015 04:18
-
-
Save oflow/34b02fa0fad2e2af15ae to your computer and use it in GitHub Desktop.
ES2015 arrow function "this"
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
function Hoge() {} | |
Hoge.prototype.consoleThis = function() { | |
console.log(this); | |
} | |
Hoge.prototype.consoleThis2 = () => { | |
console.log(this); | |
} | |
var hoge = new Hoge(); | |
hoge.consoleThis(); // Hoge | |
hoge.consoleThis2(); // Window |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment