function fillArray_(arr, length, value) {
  for (let i = 0; i < length; ++i) {
    arr[i] = value;
  }
  return arr;
}
Fills an array with a value ([].fill() not supported in Apps Script).

@param {object[]} arr - Array to fill
@param {number} length - Number of items to fill.
@param {object} value - Value to place at each index.
@return {object[]} the array, for chaining purposes