src/spec/unit/common.js
function (array1, array2) {
  if (array1.length !== array2.length) {
    return false;
  }

  // Clone the second array
  array2 = array2.concat();

  let i;

  for (i = 0; i < array1.length; i++) {
    let index = array2.indexOf(array1[i]);

    if (index === -1) {
      return false;
    }

    array2.splice(index, 1);
  }

  if (array2.length === 0) {
    return true;
  }

  return false;
}
function (array1, array2) {
  if (array1.length !== array2.length) {
    return false;
  }

  // Clone the second array
  array2 = array2.concat();

  let i;

  for (i = 0; i < array1.length; i++) {
    let index = array2.indexOf(array1[i]);

    if (index === -1) {
      return false;
    }

    array2.splice(index, 1);
  }

  if (array2.length === 0) {
    return true;
  }

  return false;
}
function ( array1 , array2 ) { if ( array1 . length !== array2 . length ) { return false ; } // Clone the second array array2 = array2 . concat ( ) ; let i ; for ( i = 0 ; i < array1 . length ; i ++ ) { let index = array2 . indexOf ( array1 [ i ] ) ; if ( index === - 1 ) { return false ; } array2 . splice ( index , 1 ) ; } if ( array2 . length === 0 ) { return true ; } return false ; }
Checks if two arrays have the same values in them, not worrying about order

@param array1 First array to check
@param array2 Second array to check

@returns {boolean} True is the arrays contain the same values
Checks if two arrays have the same values in them not worrying about order