📜  通过引用箭头函数传递变量 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:31.135000             🧑  作者: Mango

代码示例1
// Parenthesize the body of a function to return an object literal expression:
params => ({foo: bar})

// Rest parameters and default parameters are supported
(param1, param2, ...rest) => { statements }
(param1 = defaultValue1, param2, …, paramN = defaultValueN) => { 
statements }

// Destructuring within the parameter list is also supported
var f = ([a, b] = [1, 2], {x: c} = {x: a + b}) => a + b + c;
f(); // 6