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 = (elem, index, array) => { for (var i = 0; i < index; i++) { if (array[i] === elem) return false; } return true; }; const result = x.filter(unique); console.log(result);
Loading…
no comments
sign in
to comment