String.prototype.padStart

Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the start (left) of the current string.

Syntax

padStart(maxLength, fillString?)

Parameters

Examples

"yes".padStart(4)
" yes"
"yes".padStart(10, "123")
"1231231yes"

See also