array1 = ["one","two"];
array2 = [ {"name":"one","id":101} , {"name":"two","id":102} , {"name":"three","id":103} , {"name":"four","id":104} ];
The data above consists of two arrays: array1
which contains string values, and array2
which contains objects. How can we remove values from array2
that are related to array1
? I initially used for loops to write the code, but it ended up being too long. Is there any predefined method in angular-6/typescript to achieve this?
Desired Output:
array2 = [ {"name":"three","id":103} , {"name":"four","id":104} ];