code: function interleave(...arrays) {
    var more = true;
    var n = 0;
    var result = [];
    while (more) {
      more = false;
      for (var array of arrays) {
        if (n >= array.length) continue;
        result.push(array[n]);
        more = true;
      }
      n++;
    }
    return result;
  }
docs: Interleave multiple arrays.