function intersection(setA, setB) {
    const result = new Set();
    for (const elem of setB) {
        if (setA.has(elem)) {
            result.add(elem);
        }
    }
    return result;
}
Computes the intersection of two sets.

@param setA - The first set.
@param setB - The second iterable.
@returns A new set containing the elements that are in both `setA` and `setB`.