function duplicates(arr) { let map = new Map(); let resultMap = arr.reduce((prev, curr) => { return prev.set(curr, prev.get(curr) + 1 || 1); }, map); let list = []; for (let [key, value] of resultMap) { if (value > 1) { list.push(key); } ...