code: function combineMultipleArrays(arrays, func, thisArg) {
    if (arrays.length === 0) {
      throw new Error('cannot combine an empty list of arrays');
    }
    thisArg = isUndefined(thisArg) ? null : thisArg;
  
    // Check lengths
    var numArgs = arrays.length;
    var isSingle = allocArray(numArgs);
    var numElems = 1;
    var j;
    for (j = 0; j < numArgs; j++) {
      if (arrays[j].length === 1) {
        isSingle[j] = true;
      } else {
        isSingle[j] = false;
        if (numElems === 1) {
          numElems = arrays[j].length;
        } else if (numElems !== arrays[j].length) {
          throw new Error('length mismatch: expected ' + numElems +
            ' elements but found ' + arrays[j].length);
        }
      }
    }
  
    // Apply func element-wise
    var resultArray = allocArray(numElems);
    var argArray = allocArray(numArgs);
    for (var i = 0; i < numElems; i++) {
      for (j = 0; j < numArgs; j++) {
        argArray[j] = isSingle[j] ? arrays[j][0] : arrays[j][i];
      }
      resultArray[i] = func.apply(thisArg, argArray);
    }
  
    return resultArray;
  }
docs: Applies 'func' to each tuple of elements from 'arrays', an array of arrays.  The lengths of any arrays that aren't length 1 must be identical.  'thisArg' (default null) is the value to use as "this" when calling func.