//TIPS
//[JS] Array 중복제거하기(2009/06/01)
//written by Kim Yeonview : 36
//
Array.prototype.removeSame = function() {
var oldArray = this;
var b = [];
var j = 0;
oldArray.sort();
while(oldArray.length > 0) {
var newKey = oldArray.shift();
if(j == 0) {
b.push(newKey);
j++;
} else if(b[j-1] != newKey) {
b.push(newKey);
j++;
}
}
return b;
};
댓글 없음:
댓글 쓰기