Here's a neat way that involves no loops. In addition to being concise, I'm pretty sure using join is much more efficient for very large strings.
function repeat(str, num) {
return (new Array(num+1)).join(str);
}
You could also put this code on the String prototype, but I'm of the mindset that it's a bad idea to mess with the prototype of built in types.