Compare whether the array is the same

how to judge whether two arrays (which contain the multi-layer structure of the array) are congruent

May.22,2021

(JSON.stringify(one) === JSON.stringify(two))

to judge whether the array is equal is to determine whether the reference address is the same. Your one is not equal to two.


cyclic recursive judgment

instead of making wheels here, lodash, underscore and others have implemented the isEqual method,
https://www.lodashjs.com/docs.

.

simple methods, such as first floor, convert to string comparison; troublesome, loop traversal, item by item comparison

Menu