JavaScript: Repeat string

I wanted to build a string of 20 repeating characters. This function makes it really easy:

String.prototype.repeat = function(num) {
    return new Array(num + 1).join( this );
}

Now I can write:

var separator = "=".repeat(20);


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 23.20.25.122
To prevent spam please submit by clicking the kitten: