Question: how to find duplicates in an array and remove them using javascript?

Answer: 
```
var sampleArr=new Array(1,1,1,1,1,2,2,3,3,3,4,4,4); //Declare array
document.write(uniqueArr(sampleArr)); //Print the unique value

//Adds new uniqueArr values to temp array
function uniqueArr(a) {
 temp = new Array();
 for(i=0;i<a.length;i++){
  if(!contains(temp, a[i])){
   temp.length+=1;
   temp[temp.length-1]=a[i];
  }
 }
 return temp;
}

//Will check for the Uniqueness
function contains(a, e) {
 for(j=0;j<a.length;j++)if(a[j]==e)return true;
 return false;
}

```
```
for(var i=0; i < arr.length; i++)
{
    for(var j=i+1; j < arr.length; j++)
    {
        if(arr[j] == arr[i])
        {
            arr.splice(j, 1);
        }
    }
}

```