可以使用 Set 去重
Set
js复制代码let arr = [1, 2, 2, 3, 4, 4]; let uniqueArr = Array.from(new Set(arr)); // [1, 2, 3, 4]
Last updated 1 year ago