且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Arrow函数具有Groovy Closure等委托属性

更新时间:2023-12-05 16:58:58

不,箭头函数没有这样的功能,也没有任何其他功能。

No, arrow functions do not have such a feature and neither have any other functions.

范围在JS中是词法确定的,即它取决于你在哪里声明功能,你不能注入任何东西或从外面修改它。

Scope is lexically determined in JS, i.e. it depends on where you declare your functions, and you cannot inject anything or modify it from outside.

你***的赌注可能是 with statement ,虽然你必须把它放在你的箭头)功能不在调用站点,或 eval

Your best bet might be the with statement, although you have to put it inside your (arrow) function not at the call site, or eval.