how to iterate two arrays and return duplicates in javascript code example
Example: duplicate numbers in an array javascript
[1, 1, 2, 2, 3].filter((element, index, array) => array.indexOf(element) !== index) // [1, 2]
[1, 1, 2, 2, 3].filter((element, index, array) => array.indexOf(element) !== index) // [1, 2]