Skip to content

Instantly share code, notes, and snippets.

@sourcegr
Created August 18, 2021 09:38
Show Gist options
  • Save sourcegr/9cc6685eba42cc0592f99f95230aa414 to your computer and use it in GitHub Desktop.
Save sourcegr/9cc6685eba42cc0592f99f95230aa414 to your computer and use it in GitHub Desktop.
uniq list from two lists
/**
*
* finds stings from list2 that are not included in list1
*
*/
const list1 = '123,234,566'.split(',').map(x => x.trim());
const list2 = '123,234,566, 756, 877'.split(',').map(x => x.trim());
const results = list2.filter(x => list1.indexOf(x) === -1).join(',');
console.log(results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment