CoverT 47: padStart() Cycle

codeInteractive Code Example

The padStart() function pads from the start of a string with another string, until the resulting string reaches the desired length. One fun (or possibly unexpected) result is when the string you are padding with has to start a new “cycle” in order to reach the given length.

Example

console.log('999'.padStart(10, '123')); // '1231231999'