设置参数的默认值
2018-11-01 本文已影响0人
luu
//es6
functionfn(a=10,b){
console.log(a,b)
}
// before es6
functionfn(a, b) {
a = a || 10;
console.log(a, b)
}
//es6
functionfn(a=10,b){
console.log(a,b)
}
// before es6
functionfn(a, b) {
a = a || 10;
console.log(a, b)
}