Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js array equals ignore order

 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;
    },
 
PREVIOUS NEXT
Tagged: #js #array #equals #ignore #order
ADD COMMENT
Topic
Name
8+8 =