# [Javascript (ES6)](https://developer.mozilla.org/bm/docs/Web/JavaScript), 34 bytes a.sort().filter((v,i)=>v===a[i+1]) Try it: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function getDupes(a) { return a.sort().filter((v,i)=>v===a[i+1]) } console.log(getDupes([1,2,3])); console.log(getDupes([1,2,3,2,1])); console.log(getDupes([1.0, 2, 2.0, 1.0])); console.log(getDupes([1, '1', '1.0'])); console.log(getDupes([null, null, false, false, true, true])); <!-- end snippet -->