Pads string on the left side if it's shorter than length. Padding characters are truncated if they exceed length.
string
length
The string to pad.
The padding length.
The string used as padding.
Returns the padded string.
5.12.0
padStart('abc', 6)// => ' abc'padStart('abc', 6, '_-')// => '_-_abc'padStart('abc', 2)// => 'abc' Copy
padStart('abc', 6)// => ' abc'padStart('abc', 6, '_-')// => '_-_abc'padStart('abc', 2)// => 'abc'
Pads
string
on the left side if it's shorter thanlength
. Padding characters are truncated if they exceedlength
.