In this Kata, you will remove the left-most duplicates from a list of integers and return the result.
function solve(arr){
let mas = [];
arr = arr.map((item,index,array) => {
if(mas.includes(item) == false){
mas.push(item);
}
else{
array.splice(index,1);
}
});
return arr;
}
function solve(arr) {
const last = arr.reduce((acc, n, i) => (acc[n] = i, acc), {});
return arr.filter((n, i) => last[n] === i);
}