📌  相关文章
📜  防止在数组中两次添加项目 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:07.399000             🧑  作者: Mango

代码示例1
var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"];
var uniqueNames = [];
$.each(names, function(i, el){
if($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});