從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
相關文章
相關標籤/搜索