Javascript String fill(char, count)
String.prototype.fill = function(char, count) { var charToPad = ""; for(var index = 0; index < count; index++ ) { charToPad += char;/* w ww .ja va2s .c om*/ } return this + charToPad; };