I want to check if two arrays have non-repeating identical elements.
const first = [1,2,3,4]
const second = [1,2]
const result = second.every(element => first.includes(element))
//Result: true
But this code doesn't work with duplicated elements. For example:
const first = [1,2,3,4]
const second = [3,3]
const result = second.every(element => first.includes(element))
//Result: true //MUST BE false
How can I solve it? Please help!