Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including string.prototype.repeat with all npm packages installed. Try it out:

var stringPrototypeRepeat = require("string.prototype.repeat")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

string.prototype.repeat v1.0.0

A robust & optimized `String.prototype.repeat` polyfill, based on the ECMAScript 6 specification.

ES6 String.prototype.repeat polyfill Build status

A robust & optimized polyfill for the String.prototype.repeat method in ECMAScript 6.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Other polyfills for String.prototype.repeat are available:


Via npm:

npm install string.prototype.repeat

Then, in Node.js:

var repeat = require('string.prototype.repeat');

In a browser:

<script src=""></script>

NOTE: It's recommended that you install this module using a package manager such as npm, because loading multiple polyfills from a CDN (such as will lead to duplicated code.


Mathias Bynens


This polyfill is available under the MIT license.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free