[英]How does the Arrow function work in ECMAScript6
I am working on mathematical program and ready to implement new feature of ECMAScript6
Arrow
. 我正在研究数学程序,并准备实施
ECMAScript6
Arrow
新功能。 Which is very similar to Lambda
expression in C#
. 这与
C#
Lambda
表达式非常相似。
let square = y => y * y;
console.log(square(4));
I achieved my goal after using Arrow
function but still confuse how the Arrow
function is works. 使用
Arrow
函数后,我实现了目标,但仍然对Arrow
函数的工作方式感到困惑。
Is it work like Lambda
expression.Can anyone guide me on that. 它像
Lambda
表达式一样工作吗?有人可以指导我吗?
Thanks 谢谢
It's essentially doing this: 本质上是这样做的:
var square = function(y) {
return y * y;
}.bind(this);
where this
is bound to the outer scope. 其中
this
被绑定到外部范围。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.