You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing the es6 transpilation feature on https://closure-compiler.appspot.com
and I noticed that the arrow functions are not bound to "this" in the output code. Is this normal?
Eg.
let x = 2;
f(v => {
return x + v;
});
Output is:
var x = 2;
f(function(a) {
return x + a;
});
But I think it should be:
var x = 2;
f((function(a) {
return x + a;
}).bind(this));
The text was updated successfully, but these errors were encountered:
If the function never references this then it doesn't matter. If it does, then .bind(this) would be one way of transpiling it, but we went with a different way:
I was testing the es6 transpilation feature on https://closure-compiler.appspot.com
and I noticed that the arrow functions are not bound to "this" in the output code. Is this normal?
Eg.
Output is:
But I think it should be:
The text was updated successfully, but these errors were encountered: