본문 바로가기

Develop/HTML & JavaScript & CSS

jQuery 배열 중복 제거


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