<script type="text/javascript"> $(function () { var arr = [1, 1, 2, 2, 3, 3]; var result = [], isRepeated; for (var i = 0, len = arr.length; i < len; i++) { isRepeated = false; for (var j = 0, len = result.length; j < len; j++) { if (arr[i] == result[j]) { isRepeated = true; break; } } if (!isRepeated) { result.push(arr[i]); } } alert(result); }) </script>
如上是脚本最后可以弹出 1,2,3的效果,就是筛选重复数据。
千秋此意
Tobey_滔