# The String repeat() method

> Learn how the JavaScript repeat() method returns a new string repeated a given number of times, returning an empty string for 0 and a RangeError for negatives.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2019-02-27 | Topics: [JavaScript](https://flaviocopes.com/tags/js/) | Canonical: https://flaviocopes.com/javascript-string-repeat/

Introduced in [ES2015](https://flaviocopes.com/es6/), repeats the strings for the specificed number of times:

```js
'Ho'.repeat(3) //'HoHoHo'
```

Returns an empty string if there is no parameter, or the parameter is `0`. If the parameter is negative you'll get a RangeError.
