padStart
The padStart() method pads the current string with a given string to reach a fixed length. The padding is applied at the start of the current string.
Interactive example
Syntax
Classic signature
typescript
function padStart<
GenericInput extends string
>(
input: GenericInput,
targetLength: number,
padString: string
): stringCurried signature
typescript
function padStart<
GenericInput extends string
>(
targetLength: number,
padString: string
): (input: GenericInput) => stringParameters
input: The string to pad.targetLength: The length of the resulting string once padded.padString: The string to use to pad the current string.
Return value
A new string of the specified length, padded with the provided string from the start.
