Hi all,

During the development of an ES6 web application, I came across a situation
where I wanted to bind 'this' of the outer function to a parameter of an
inner function, here is a quick snippet demonstrated what I'm trying to do:

function outer() {
  function inner(_this = this) {
    console.log(_this.a);
  }
  inner.call({});
}
outer.call({a: 1});

In the latest Firefox, the above script prints 'undefined'. This seems
pretty counter-intuitive, and it also fails when I try to pass 'this.a' as
default value for the parameter of the inner function. I wonder if this is
an intended behavior? Thanks in advance.

Yours,
Charles Weng
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to