node-lib

@wtasnorg/node-lib


@wtasnorg/node-lib / repeatString

Function: repeatString()

repeatString(s, n): string

Defined in: src/strings.ts:689

Repeat returns a new string consisting of count copies of the string s.

Parameters

s

string

String to repeat.

n

number

Returns

string

Repeated string.

Throws

If count is negative.

Example

repeat("na", 4); // "nananana"
repeat("na", 0); // ""
repeat("x", -1); // throws RangeError