![]() |
VOOZH | about |
Lodash _.xorWith() method is similar to the _.xor() method except that it accepts a comparator which is invoked to compare elements of arrays. Order of result values which is determined by the order they occur in the arrays.
_.xorWith([arrays], [comparator]);Example 1: In this example, we are operating xor on the given arrays and printing the results in the console.
Output:
[{ x: 4, y: 3 }, { x: 3, y: 3 }]Example 2: In this example, we are operating xor on the given arrays and printing the results in the console.
Output:
[ 23, 4, 6, 98 ]Example 3: In this example, we are operating xor on the given arrays and printing the results in the console.
Output:
[ 's', 'r' ]Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.