code: function merge(a, b) {
  
      /* result set */
      var c = [];
  
      /* as long as there are elements in the arrays to be merged */
      while (a.length > 0 || b.length > 0) {
  
        /* are there elements to be merged, if yes, compare them and merge */
        var n = a.length > 0 && b.length > 0 ? a[0] < b[0] ? a.shift() : b.shift() : b.length > 0 ? b.shift() : a.length > 0 ? a.shift() : null;
  
        /* always push the smaller one onto the result set */
        if (n !== null) {
          c.push(n);
        }
      }
      return c;
    }
docs: /* merges two sorted arrays into one sorted array