자바스크립트

배열 객체에서 중복값 제거

칩사마코더 2016. 12. 2. 18:59

function get_unique_from_array_object(array,property){

var unique = {};

var distinct = [];

for(var i in array ){

if( typeof(unique[array[i][property]]) == "undefined"){

distinct.push(array[i]);

}

unique[array[i][property]] = 0;

}

return distinct;

}


배열 객체에서 중복값 제거 하는 함수인데 봐도 잘 모르겠다 쉬바;


시간 날때 한번 찾아보자