JavaScriptStringrepeat

Returns a new string with the original string repeated n times.

Syntax

str.repeat(count)

Example

Enter values below to update the example in real time.

const
divider
console
const divider = "-".repeat(20);
console.log(divider);   // "--------------------"