📜  Javascript一参数胖箭头 - Javascript代码示例

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

代码示例1
//When there is only one parameter name, you can omit the parentheses around the parameter list. If the body is a single expression, rather than a block in braces, that expression will be returned from the function. So, these two definitions of square do the same thing:
const square1 = (x) => { return x * x; };
const square2 = x => x * x;