📜  语法 () => {} 是什么意思 - Javascript 代码示例

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

代码示例1
(param1, param2, …, paramN) => { statements }
(param1, param2, …, paramN) => expression
         // equivalent to:  => { return expression; }

// Parentheses are optional when there's only one parameter:
(singleParam) => { statements }
singleParam => { statements }

// A function with no parameters requires parentheses:
() => { statements }