<script> let a = [1,2,3,4,2,42,1,5,23,212,13,42,4] let b = a.reduce((prev,cur)=> { prev.indexOf(cur) === -1 && prev.push(cur) return prev },[]) console.log(b); // [1,2,3,4,42,5,23,212,13] </script>