This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.diff = function(arr2) { return this.filter(x => !arr2. includes(x)); } | |
let arr1 = ['release','layer-1','bsp-1'] | |
console.log(`OG list: ${arr1}`); | |
let arr2 = ['release','layer-2','bsp-1'] | |
console.log(`New list: ${arr2}`); | |
console.log(`Remove list: ${arr1.diff(arr2)}`); | |
let newDl = arr2.diff(arr1); | |
console.log(`New downlowd list: ${newDl}`); | |
console.log(`Refresh list: ${arr2.diff(newDl)}`); |