code: function merge(arrays, comp) {
  		var mid,
  			a1, i1,
  			a2, i2,
  			result;
  
  		if (arrays.length === 1) {
  			return arrays[0];
  		} else if (arrays.length === 2) {
  			// merge two arrays
  			a1 = arrays[0];
  			a2 = arrays[1];
  			i1 = i2 = 0;
  			result = [];
  			while(i1 < a1.length && i2 < a2.length) {
  				if (comp(a2[i2], a1[i1]) > 0) {
  					result.push(a1[i1]);
  					i1++;
  				} else {
  					result.push(a2[i2]);
  					i2++;
  				}
  			}
  			while(i1 < a1.length) {
  				result.push(a1[i1]);
  				i1++;
  			}
  			while(i2 < a2.length) {
  				result.push(a2[i2]);
  				i2++;
  			}
  			return result;
  		} else {
  			mid = Math.floor(arrays.length / 2);
  			return merge([
  				merge(arrays.slice(0, mid), comp),
  				merge(arrays.slice(mid), comp)
  			], comp);
  		}
  
  	}
docs: Merge a number of arrays