Skip to content

Instantly share code, notes, and snippets.

@Fouzyyyy
Last active October 14, 2017 22:06
Show Gist options
  • Save Fouzyyyy/d98250c47dddc4a15ca195fe4e4e1d87 to your computer and use it in GitHub Desktop.
Save Fouzyyyy/d98250c47dddc4a15ca195fe4e4e1d87 to your computer and use it in GitHub Desktop.
This variable in arrow functions
var obj = {foo: 'foo', bar: 'bar'};
function func() {
// IIFE!
(() => {
console.log(this);
})();
}
let boundFunc = func.bind(obj);
boundFunc();
// printed value: {foo: "foo", bar: "bar"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment