Edit: Please read the question before closing it! The suggested answer has zero to do with what I asked. I'm not after a single array solution, I'm using two arrays...
I'm deduplicating an array but when I go to find the difference it doesn't find any because whats in the new array is in the old array:
const original = [1,2,2,3,4]
const newArr = Array.from(new Set(original).values());
const diff = original.filter(line => !newArr.includes(line));
What I expect to find is that the difference found is 2
. In my real example I'm using crypto wallet addresses, and I need to deduplicate the list, but I also want to print to stdout what the differences are between the original array and the new array.
Example
Given the below input
123asd123asd123
123asd123asd123
890wer890wer809
I expect the following output
Deduplication complete!
Wallet 123asd123asd123 - Duplicate removed