const a = [3, 4, 5, 5, 8, 9] const b = [9, 8, 3, 4, 5, 5] const c = [1, 5, 7, 8, 9, 0] const d = [3, 4, 5, 6] function comparison(a, b) { if (a.length !== b.length) { return false } let i = 0; a.forEach((item) => { if (!b.includes(item)) { i++ return false } }) if (i > 0) { return false } return true } const e = comparison(a, b); console.log(e); const f = comparison(a, c); console.log(f); const g = comparison(a, d); console.log(g);