找出数组 arr 中重复出现过的元素

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>javascript实例</title>
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
function removeWithoutCopy(arr, item) {
for(var i=0;i<arr.length;i++)
{
if(arr[i]==item)
{
arr.splice(i,1);
i=0;
}
}
return arr;
}
alert(removeWithoutCopy([1,2,4,3, 2,8], 2));

</script>
</head>
<body>

</body>
</html>

原文地址:https://www.cnblogs.com/ll-taj/p/5870824.html