Is there a more efficient method for determining if two arrays have common elements?
In languages like Java, I would utilize streams and lambda expressions.
lst1.stream().anyMatch(c -> lst2.contains(c))
However, I am unsure of how to achieve this in Typescript/Javascript.
let lst1: string[] = ["aaa", "bbb", "ccc"];
let lst2: string[] = ["ddd", "eee", "bbb"]; // 1 match at "bbb";
let matches: boolean = false;
for (let a of this.lst1)
{
for (let b of this.lst2)
{
if (a === b)
{
matches = true;
}
}
}