lib/Perform Intersection Between Two Arrays.js
// intersection contains the elements of array1 that are also in array2
intersection contains the elements of array1 that are also in array2
intersection contains the elements of array1 that are also in array2
function performIntersection(arr1, arr2) {
    const setA = new Set(arr1);
    const setB = new Set(arr2);
    let intersectionResult = [];
    for (let i of setB) {
        if (setA.has(i)) {
            intersectionResult.push(i);
        }
    }
    return intersectionResult;
}
function performIntersection ( arr1 , arr2 ) { const setA = new Set ( arr1 ) ; const setB = new Set ( arr2 ) ; let intersectionResult = [ ] ; for ( let i of setB ) { if ( setA . has ( i ) ) { intersectionResult . push ( i ) ; } } return intersectionResult ; }
intersection contains the elements of array1 that are also in array2
intersection contains the elements of array1 that are also in array2
// converting into Set