I want to the set difference arrayA - arrayB , but when the arrayA include array, it does not work.
e.g
console.log(_.difference([[1]],[[1]]));
// -> [[1]] ,not []
I see samevalueszero http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero
seems like Return true if x and y are the same Object value. Otherwise, return false.
We alwasy compare two arrays use Array.toString() and compare the string
var arrayA = [1], arrayB = [1];
arrayA.toString() === arrayB.toString() // true
arrayA == arrayB //false;
How can i get the difference in that times?
Do you actually want the difference or to compare two objects for equivalence?
This is coming in v4 as _.differenceWith(array, other, _.isEqual).
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
This is coming in v4 as
_.differenceWith(array, other, _.isEqual).