Binding arrow functions.

Domenic Denicola domenic at
Sun Aug 24 19:12:36 PDT 2014

From: es-discuss [mailto:es-discuss-bounces at] On Behalf Of Mark Everitt

> There seems to be no clean way to tell apart regular functions and arrow functions (the only way I can do this is by looking at the result of toString). That being the case, arrow functions mean that we can no longer trust call, apply and bind, since we cannot easily tell if the function we want to bind is an arrow function and will silently ignore us.

There have been multitudes of threads on this before, but the short recap is that arrow functions are functions, not methods. That is, they do not change their behavior depending on what `thisArg` they are called with. Other examples of non-method functions include:

function f(x) {
  return x * 2;

var g = (function () { return; }).bind({ foo: 5 });

function F(x) {
  var hidden = x * 2;
  this.f = function () {
    return hidden;

var h = (new F(12)).f;

More information about the es-discuss mailing list