js中箭头函数

js 中的箭头函数

📌 js

函数的正常写法

1
2
3
const double=function(x){
return x*2;
}

箭头函数

1
2
3
const double=(x)=>{
return x*2;
}