Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get unique array javascript

// one liner solution to get a unique array by object id
[{_id: 10},{_id: 20}, {_id: 20}].filter((item, i, ar) => ar.findIndex(each => each._id === item._id) === i)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #unique #array #javascript
ADD COMMENT
Topic
Name
6+8 =