# [Javascript (ES6)](https://developer.mozilla.org/bm/docs/Web/JavaScript), 41 bytes a=(a)=>a.sort().filter((v,i)=>v===a[i+1]) ### Expanded: function getDuplicates(arr) { // This makes use of the fact that sort() mutates the original array arr.sort().filter((value, index) => value === arr[index + 1]); } Try it: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> a=(a)=>a.sort().filter((v,i)=>v===a[i+1]) console.log(a([1,2,3])); console.log(a([1,2,3,2,1])); console.log(a([1.0, 2, 2.0, 1.0])); console.log(a([1, '1', '1.0'])); console.log(a([null, null, false, false, true, true])); <!-- end snippet -->