javascript - How is .call supposed to work for ES6 Arrow Functions (according to the standards)? -


i using cross-compiler (babel, typescript) es6 , not support proper .call behavior functions made => syntax; when call them .call, this value still 1 inherited parent scope when first made them, instead of being first argument passed in .call.

is intentional behavior, per es6 standards (which disappointing)? or limitation of cross-compiler?

this the spec says:

an arrowfunction not define local bindings arguments, super, this, or new.target. any reference arguments, super, this, or new.target within arrowfunction must resolve binding in lexically enclosing environment.

i.e. it's fixed context in defined. can't dynamically change it. on function.prototype.call says:

if func arrow function or bound function thisarg ignored function [[call]] in step 5.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -