📅  最后修改于: 2022-03-11 14:57:28.545000             🧑  作者: Mango
const haveSameContents = (a, b) => {
for (const v of new Set([...a, ...b]))
if (a.filter(e => e === v).length !== b.filter(e => e === v).length)
return false;
return true;
};
EXAMPLES
haveSameContents([1, 2, 4], [2, 4, 1]); // true