Javascript Array fill(value, start = 0, end = this.length)
Array.prototype.fill = function(value, start = 0, end = this.length) { let arr = Array.prototype.slice.call(this); start < 0 && (start += this.length); end < 0 && (end += this.length); end > this.length && (end = this.length); for (let i = start; i < end; i++) { arr[i] = value;/*from www . j a v a2 s . c o m*/ } return arr; }