标签:style blog ar color sp for on div log
/js小方法记录
1 var result = new Array();//去重后结果数组 2 var arr=[1,2,3,4,5,1,2,3,10];//需去重的数组 3 var hash = {}; 4 for (var i = 0, elem; (elem=arr[i])!= null; i++) { 5 if (!hash[elem]) { 6 result.push(elem); 7 hash[elem] = true; 8 } 9 } 10 console.info(result); 11 VM1823:11 [1, 2, 3, 4, 5, 10]
标签:style blog ar color sp for on div log
原文地址:http://www.cnblogs.com/shikelong/p/4173188.html