1. /* ES2015 Rest/Spread */
    2. let [x, ...xs] = [1,2,3]; //Rest
    3. // x=1; xs=[2,3]
    4. let arr = [1, ...xs];// Spread
    5. // arr=[1,2,3]
    6. // 任何实现了Iterable接口的JS对象都是Iterable
    7. // Array/String/Map/Set 是语言内置的Iterable

    而能够对Object做Rest/Spead则是一直到ES9也就是ES2018才有的特性

    1. /* ES2018 Objetc Rest/Spread */
    2. let {x, ...kvs} = {x:1, y:2, z:3} // Rest
    3. // kvs = {y:2, z:3}
    4. let o = {x:1, ...kvs} // Spread
    5. // o = {x:1, y:2, z:3}

    ES2020新特性
    optional chaining
    nullish coalescing