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

问题:

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. 我须要删除重复项,并将惟一值放入新数组中。 less

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解决方案。 url

Similar question: 相似的问题:


解决方案:

参考一: https://stackoom.com/question/cj3F/从JS数组中删除重复的值-duplicate
参考二: https://oldbug.net/q/cj3F/Remove-duplicate-values-from-JS-array-duplicate
相关文章
相关标签/搜索