<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
var arr1=[1,5,4,2,2,2,6,2,2,2,4,8];
function uique(arr){
for(var i=0,hash=[],res=[];i<arr.length;i++){
if(hash[arr[i]]===undefined){
hash[arr[i]]=true;
res[res.length]=arr[i];
}
}
return res;
}
res=uique(arr1);
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
var arr1=[1,5,4,2,2,2,6,2,2,2,4,8];
function uique(arr){
for(var i=0,hash=[],res=[];i<arr.length;i++){
if(hash[arr[i]]===undefined){
hash[arr[i]]=true;
res[res.length]=arr[i];
}
}
return res;
}
res=uique(arr1);
</script>
</body>
</html>