After we follow this code bellow, we'll get tempArr[] which store unique items.
Example: array[1,10,2,2,5,4,5,6,6,8,10,8] => array[1,2,4,5,6,10,8]
======================================
function contains(a, e) {
for(j=0;j<a.length;j++)if(a[j]==e)return true;
return false;
}
if(!contains(tempArr, urlObj[i].group)){
tempArr.length +=1;
tempArr[tempArr.length-1] = urlObj[i].group;
}
May 18, 2009
Javascript Unique Item in Array
Posted by samneang
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment