There is no such function, but hey, you can create it:
String.prototype.repeat = function(times) {
return (new Array(times + 1)).join(this);
};
Usage:
var s = " ".repeat(3);
Of course you could write this as part of a standalone group of functions:
var StringUtilities = {
repeat: function(str, times) {
return (new Array(times + 1)).join(str);
}
//other related string functions...
};
Usage:
var s = StringUtilities.repeat(" ", 3);