Filter Unique

node v10.24.1
version: master
endpointsharetweet
const x = [1,2,3,4,1,3,5,8,9,9]; const unique = () => { let cache; return (elem, index, array) => { if (!cache) cache = new Set(array); return cache.delete(elem); }; }; x.filter(unique());
Loading…

no comments

    sign in to comment