fp.js
function fill(list, value, startIndex=0, endIndex=list.length){
    if (!(list && Array.isArray(list))) {
      // Manually currying
      let args = arguments;
      return (list) => fill(list, ...args);
    }

    return Array(...list).map((x,i)=> {
      if(i>= startIndex && i <= endIndex) {
        return x=value;
      } else {
        return x;
      }
    });
  }
function fill(list, value, startIndex=0, endIndex=list.length){
    if (!(list && Array.isArray(list))) {
      // Manually currying
      let args = arguments;
      return (list) => fill(list, ...args);
    }

    return Array(...list).map((x,i)=> {
      if(i>= startIndex && i <= endIndex) {
        return x=value;
      } else {
        return x;
      }
    });
  }
function fill ( list , value , startIndex = 0 , endIndex = list . length ) { if ( ! ( list && Array . isArray ( list ) ) ) { // Manually currying let args = arguments ; return ( list ) => fill ( list , ... args ) ; } return Array ( ... list ) . map ( ( x , i ) => { if ( i >= startIndex && i <= endIndex ) { return x = value ; } else { return x ; } } ) ; }
Fills array using specified values.
Can optionally pass in start and index of array to fill.
Default startIndex = 0. Default endIndex = length of array.
Fills array using specified values . Can optionally pass in start and index of array to fill . Default startIndex = 0 . Default endIndex = length of array .