Javascript Array fill(first, last, value)
// fill in a range of an array with a single value Array.prototype.fill = function (first, last, value) { var i;/*from w w w . ja v a 2 s . com*/ for (i = first; i <= last; i++) { this[i] = value; } }