为啥数组就可以, 比如说
let [x, ...y] = ['a', 'b', 'c'];
// => x = 'a'
// => y = ['b', 'c']
// OK 啊~
let {foo, ...oths} = {foo: 'bar', x: 1, y: 2, z: 3}
// SyntaxError: Unexpected token ...
参数也是可以的
const fn = (x, ...oths) => {console.log(oths);}
为啥 Object 不可以 7.0 下能用吗?
let [x, ...y] = ['a', 'b', 'c'];
// => x = 'a'
// => y = ['b', 'c']
// OK 啊~
let {foo, ...oths} = {foo: 'bar', x: 1, y: 2, z: 3}
// SyntaxError: Unexpected token ...
参数也是可以的
const fn = (x, ...oths) => {console.log(oths);}
为啥 Object 不可以 7.0 下能用吗?
