padStart() method returns a new string that pads the start of the original string until it reaches a given length.
syntax ↴
padStart(length, string) ↴
length The length of the resulting string once the current string has been padded.
If the value is less than or equal to string.length, the current string will be returned as-is.
string (optional). The string to pad the current string with.
If string is too long to stay within target length, it will be truncated from the end.
padStart() method does not change the value of the original string.
padStart() method pads a string with another string (multiple times) until it reaches a given length.
The length of the string is the length after it has been padded.
myString.padStart(length)
myString.padStart(length, string)