📜  js 数组等于忽略顺序 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:34.788000             🧑  作者: Mango

代码示例1
equalsIgnoreOrder(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;
    },