_.isEqual reporting a difference when there is none
The objects are not equal since even when deep-comparing, an array is an ordered collection, and order matters. Your array holds the same values, but not at the same order.
I realise this doesn't apply in your example but I found another case where lodash returns not equal for objects where JSON.stringify
returns the same string.
In my case, one object had a property with the value undefined
whereas the other object did not have that property at all.
Personally, I'd argue lodash is incorrect in this case but it's a bit subjective.
The order in an array matters, so
_.isEqual([1,2], [2, 1]) === false
which is why your example returns false.