function merge(a = [], b = []) {
  const merged = [];
  // merge elements on a and b in asc order. Run-time O(a + b)
  for (let ai = 0, bi = 0; ai < a.length || bi < b.length;) {
    if (ai >= a.length || a[ai] > b[bi]) {
      merged.push(b[bi++]);
    } else {
      merged.push(a[ai++]);
    }
  }
  return merged;
}
Merge two arrays in asc order
@example
   merge([2,5,9], [1,6,7]) => [1, 2, 5, 6, 7, 9]
@param {array} a
@param {array} b
@returns {array} merged arrays in asc order