I was working on a project that I needed a functionality like python set
which removes all duplicates values and returns a new list, so I wrote this function maybe useful to someone
function set(arr) {
var res = [];
for (var i = 0; i < arr.length; i++) {
if (res.indexOf(arr[i]) === -1) {
res.push(arr[i]);
}
}
return res;
}