Home  >  Q&A  >  body text

JS set方法的使用问题

我怎么取到对应的值以及长度呢?

var set = new Set([1, 2, 3, 4, 4,4,4,4,2,2,2]);
         console.log(set)


phpcn_u699phpcn_u6992801 days ago1739

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-10-01 00:21:37

    Questions about using the JS set method - Q&A on the PHP Chinese website - Questions about using the JS set method - Q&A on the PHP Chinese website

    Take a look around and learn.

    reply
    0
  • 巴扎黑

    巴扎黑2017-02-17 11:01:45

    length: set.size;get value: let origin = Array.from(set);


    reply
    0
  • Cancelreply