wizard999
10/14/2019 - 1:03 AM

Typescript compare difference between tow array

var a1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
var a2 = ['a', 'b', 'c', 'd'];

let missing = a1.filter(item => a2.indexOf(item) < 0);
console.log(missing); // ["e", "f", "g"]


let selectedArray = this.types.filter(item => this.selectedTypes.indexOf(item.out_type_code) > -1).map((i) => {return i.out_type_description});
this.selectedTypesString = selectedArray.join(',');