I am looking for a way to know if an array contains all elements with distinction.
For example, b.containsDistinct(a) would return true and c.containsDistinct(a) would return false.
a = [1, 1, 1, 2]
b = [1, 2, 1, 1, 3] // return true
c = [1, 2, 3] // return false
The solutions I could find were only a.every(i => b.indexOf(i) !== -1) but there are not working for the situation where the elements are the same
How would you solve that ?