Remove duplicates from an array in Javascript

Consider an array=[1,2,3,3,2,4,1,1]

We need to write a function to remove duplicates from an array.

function(arr){
let unique=[];

for(let i=0;i<arr.length;i++){

if(unique.indexOf(arr[i])== -1)
{
unique.push(arr[i]);
}
}
}
return unique;
}