How to Get All Non-Unique Values in a JavaScript Array?

John Au-Yeung
JavaScript in Plain English
3 min readJun 8, 2021

--

Photo by Andy Brunner on Unsplash

Sometimes, we may want to get all duplicate values from a JavaScript array.

In this article, we’ll look at ways to get all non-unique values in a JavaScript array.

Array.prototype.filter

We can use the JavaScript array’s filter method to return an array that meets the given condition.

--

--