Skip to content

Instantly share code, notes, and snippets.

@qubyte
Last active August 29, 2015 14:07
Show Gist options
  • Save qubyte/2710ff6dbae46848f99d to your computer and use it in GitHub Desktop.
Save qubyte/2710ff6dbae46848f99d to your computer and use it in GitHub Desktop.
Fat arrow function placeholders.

Whilst I wait for better support for fat arrow functions, they can be emulated with what I like to call an immediately bound function expression (IBFE).

For example this:

var test = (a, b, c) => console.log(a, b, c, this.xyz);

Can be emulated with:

var test = (function (a, b, c) {
  console.log(a, b, c, this.xyz);
}).bind(this);

It's bulkier for sure, but later on you can just swap it out for the arrow function equivalent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment