然后我们再去看看 es9中对,对象扩展运算符的增加.
可以看到说...这个rest参数与spread扩展运算符...,在es6中已经有了,但是es6,这个只是针对于数组的
es9可以针对对象提供了,类似数组的rest参数和扩展运算符.
可以看到上面我们声明一个connect({host,port,username,password}){
console.log(host);
console.log(port);
console.log(username);
console.log(password);
}
我们声明connect函数,然后可以看到参数是个对象,
然后我们调用的时候,传入这个对象.
然后这里我们可以把,后面connect这个函数的,后两个参数,换成一个...user
然后这样的话,我们调用connect函数的时候,
前两个函数是赋值给对应的参数,然后后面的参数,比如username,passwor