phuocng/1loc

Compare two arrays regardless of order

dmytrohavrysh opened this issue · 0 comments

This code doesn't work in some cases:
// Or
const isEqual = (a, b) => a.length === b.length && a.every((v) => b.includes(v));

For example:
isEqual(['a', 'a'], ['b', 'a'])
gives true, but it must be false.