Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function duplicates(arr) {
- const dupsItems = [];
- for(let i = 0; i < arr.length; i++) {
- for(let j = i + 1; j < arr.length; j++) {
- if(arr[i] === arr[j]) {
- dupsItems.push(arr[i]);
- }
- }
- }
- return [dupsItems.length, dupsItems];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement