I have multiple arrays of string, what I'm trying to do is extract the common values in a new array.
Let's say we have :
const arr1:string[] = ['0','1','2','3','4'];
const arr2:string[] = ['0','1','2'];
const arr3:string[] = ['0','2', '5'];
const arr4:string[] = ['1','2', '3'];
The result should be :
const result:string[] = ['2'];
Because 2
is present in each array.
With two arrays I can use filter
but with more than two how can I achieve that ?