String.repeat

repeat — Repeats the string x number of times.

Description

String.repeat(integer count)

Parameters

Name Description Type Default Optional
count Number of times to repeat integer No

Return values

string primitive.

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – replace example
console.log('Hello World'.repeat(2)); // Hello WorldHello World

External references