Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript Compare two arrays regardless of order

const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);

// Examples
isEqual([1, 2, 3], [1, 2, 3]);      // true
isEqual([1, 2, 3], [1, '2', 3]);    // false
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #Compare #arrays #order
ADD COMMENT
Topic
Name
9+8 =