Answers for "how to compare the contents of two arrays js"

2

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
Posted by: Guest on July-02-2020

Code answers related to "how to compare the contents of two arrays js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language