showing results for - "prevent adding the item twice in an array javascript"
Deanna
03 Jan 2019
1var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"];
2var uniqueNames = [];
3$.each(names, function(i, el){
4if($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
5});