jrobinsonc
8/12/2015 - 1:25 PM

Repeat String - Javascript

Repeat String - Javascript

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

alert( "string to repeat\n".repeat( 4 ) );