search

Home  >  Q&A  >  body text

Why can [...Set] return an Array?

let mySet = new Set ([1,2,3])
[...mySet] //[1,2,3]
曾经蜡笔没有小新曾经蜡笔没有小新2816 days ago858

reply all(2)I'll reply

  • 扔个三星炸死你

    扔个三星炸死你2017-06-30 10:02:00

    ES6 syntax, data spread operator (...), can convert certain data structures into arrays

    reply
    0
  • 阿神

    阿神2017-06-30 10:02:00

    ES6 syntax, [...mySet] is a way of writing destructuring assignment, reference: http://es6.ruanyifeng.com/

    reply
    0
  • Cancelreply