ES6中的扩展运算符之三个点...

 扩展运算符(...)用于取出参数对象或者数组中的所有可遍历属性,拷贝到当前对象之中

案例:


          let a =  [1,2,3] 
          let b =  [4,5,6]
          let c = []
          let c = [...a,...b]   //log打印c =  [1,2,3,4,5,6]
          let c = [...a,...b,7,8]  //c = [1,2,3,4,5,6,7,8]

猜你喜欢

转载自blog.csdn.net/weixin_57607714/article/details/123008018