I'm using knockout and have two arrays.
I want to find the difference between the arrays, i.e. any items that are in the longer array that are not in the smaller one.
i have
console.warn(items1); // 10
console.warn(items2); // 11
var filtered = ko.utils.arrayFilter(items1, function (e) {
return !items2.indexOf(e) > -1;
});
console.warn(filtered); // 10
How do I changes this to leave filtered with the 1 new item?
I've tried return items2.indexOf(e) > -1;
I've tried switching the arrays around on the filter and return.
I've tried return items2.indexOf(e) == -1;
All either give 10, 11, or 0.
How do I make it return 1
?