comparing two arrays in node js code example
Example 1: es6 compare two arrays
let difference = arrA.filter(x => !arrB.includes(x));
Example 2: compare arrays javascript
// For regular 1D array
const array1 = [1,2,3,4]
const array2 = [1,2,3,4]
array1.join() === array2.join()
// '1,2,3,4' === '1,2,3,4'
// For anything more complex
const array3 = [1,2,3,[1,2,3]]
const array4 = [1,2,3,[1,2,3]]
JSON.stringify(array3) === JSON.stringify(array4)