How to convert Set to Array?

前端 未结 10 1070
余生分开走
余生分开走 2020-11-28 01:04

Set seems like a nice way to create Arrays with guaranteed unique elements, but it does not expose any good way to get properties, except for generator [Set

10条回答
  •  渐次进展
    2020-11-28 01:33

    Assuming you are just using Set temporarily to get unique values in an array and then converting back to an Array, try using this:

    _.uniq([])
    

    This relies on using underscore or lo-dash.

提交回复
热议问题