function sockMerchant(n, ar) {
    let countSocks = 0;
    ar.forEach ((r, index) => {
        if (r != null) {
            let pairFound = ar.indexOf(r, index + 1);
            if (pairFound > -1) {
                ar[pairFound] = null;
                countSocks++;
            }
        }
    });
    return countSocks;
}
// Complete the sockMerchant function below.
Complete the sockMerchant function below.
Complete the sockMerchant function below .
function sockMerchant(n, ar) {
    let countSocks = 0;
    ar.forEach ((r, index) => {
        if (r != null) {
            let pairFound = ar.indexOf(r, index + 1);
            if (pairFound > -1) {
                ar[pairFound] = null;
                countSocks++;
            }
        }
    });
    return countSocks;
}
function sockMerchant ( n , ar ) { let countSocks = 0 ; ar . forEach ( ( r , index ) => { if ( r != null ) { let pairFound = ar . indexOf ( r , index + 1 ) ; if ( pairFound > - 1 ) { ar [ pairFound ] = null ; countSocks ++ ; } } } ) ; return countSocks ; }
Complete the sockMerchant function below.
Complete the sockMerchant function below .