Duplicate Numbers

Write a function that takes in an array of numbers, and returns a new array of all duplicate numbers.

solution([1, 2, 2, 3, 1])  // should return [1, 2]
solution([1, 1, 1, 1, 2, 3, 3])  // should return [1, 3]