从JS数组中删除重复的值[duplicate] - Remove duplicate values from JS array [duplicate]

08/13 03:11
阅读数 39

问题:

This question already has answers here : 这个问题已经在这里有了答案
Closed last year . 去年关闭。

I have a very simple JavaScript array that may or may not contain duplicates. 我有一个非常简单的JavaScript数组,其中可能包含重复项,也可能不包含重复项。

var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"];

I need to remove the duplicates and put the unique values in a new array. 我需要删除重复项,并将唯一值放入新数组中。

I could point to all the codes that I've tried but I think it's useless because they don't work. 我可以指出我尝试过的所有代码,但是我认为这没用,因为它们不起作用。 I accept jQuery solutions too. 我也接受jQuery解决方案。

Similar question: 类似的问题:


解决方案:

参考一: https://stackoom.com/question/cj3F/从JS数组中删除重复的值-duplicate
参考二: https://oldbug.net/q/cj3F/Remove-duplicate-values-from-JS-array-duplicate
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
在线直播报名
返回顶部
顶部