intersection
intersection() function
Returns Iterable/AsyncIterable of all elements in the iterable2
contained in the iterable1
.
Signature:
declare function intersection<T>(iterable1: Iterable<T>, iterable2: Iterable<T>): IterableIterator<T>;
Returns:
IterableIterator<T>
Example
const iter = intersection([2, 1], [2, 3, 4]);
iter.next(); // {value: 2, done:false}
iter.next(); // {value: undefined, done: true}