ES6中的箭头函数=>

版权声明:哼!坏人!这是我辛辛苦苦码的! https://blog.csdn.net/DurianPudding/article/details/88015320

箭头函数详解

x => y
//等价于
function(x) {
	return y
}

(x, y) => z 
//等价于
function(x, y) {
	return z
}

箭头函数和匿名函数有个明显的区别:箭头函数内部的this是词法作用域,由上下文确定。

猜你喜欢

转载自blog.csdn.net/DurianPudding/article/details/88015320