Map
is not related to map
: Map is a constructor used to create an instance of Map, and .map is a method used process every element of array.
If you use Set just to create an array of unique values you can omit .values execution and just convert your result Set to array:
[...new Set([1,1,1,1,1,2,1])]
// or
Array.from(new Set([1,1,1,1,1,2,1]))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…