---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# String.prototype.repeat()

The **`repeat()`** method constructs and returns a new string
which contains the specified number of copies of the string on which it was called,
concatenated together.

## Syntax

```js
repeat(count)
```

### Parameters

- `count`
  - : An integer between `0` and
    [`+Infinity`](../../../globals/Number/POSITIVE_INFINITY.mdx), indicating the
    number of times to repeat the string.

### Return value

A new string containing the specified number of copies of the given string.

### Exceptions

- Throws a `RangeError` if repeat count is negative.
- Throws a `RangeError` if repeat count is infinity or overflows maximum string size.
