一个函数比方说有2个必填的参数,还有一个对象结构的参数,代码如下
function books(js,h5,{address,company} = {}){
console.log(js,h5,address,company);
}
books("javascript","html",{"address":"上海","company":"百步生活"});
将会输出javascript html 上海 百步生活
结构参数其实就是解构对象
一个函数比方说有2个必填的参数,还有一个对象结构的参数,代码如下
function books(js,h5,{address,company} = {}){
console.log(js,h5,address,company);
}
books("javascript","html",{"address":"上海","company":"百步生活"});
将会输出javascript html 上海 百步生活
结构参数其实就是解构对象