普通function函数:
改写成箭头函数形式:
1.把function删掉
var one = function ()变为var one = ()
2.在()后面加上箭头=>
var one = ()变为var one = () =>
结果不变,返回值为一个表达式可以省略{}与return
当箭头函数有单个参数时,可以将()去掉,当有多个参数或无参时则不可以去掉()
1.有单个参数
let two = function(a){}
let two = a => {}
2.无参数
let two = function(){}
let two = () => {}
3.多参数
let two = function(a,b){}
let two = (a,b) => {}