Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
Filter Unique
node v10.24.1
version:
master
endpoint
share
tweet
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