es6->func

来源:互联网 发布:全景图拼接软件 编辑:程序博客网 时间:2024/06/04 01:38

-函数
1.默认值

function test(x,y=''2"){
console.log(x,y)
}
test(1)//1,2

2.未知行参

function test(...arg){
console.log(arg)
}
test(1,2,3)//1,2,3

3.行参赋值
function test(x,y=x){
console.log(x,y)
}
console.log(test(1))//1,1