Pads a string on the left with a specified character until it reaches the desired length.
The string to pad.
The target length of the padded string.
The character to use for padding (defaults to a space).
The padded string, or the original string if its length is already greater than or equal to the target length.
console.log(padLeft("hello", 8)); // " hello"console.log(padLeft("hi", 5, "*")); // "***hi"console.log(padLeft("hello", 3)); // "hello"console.log(padLeft("", 3, "0")); // "000" Copy
console.log(padLeft("hello", 8)); // " hello"console.log(padLeft("hi", 5, "*")); // "***hi"console.log(padLeft("hello", 3)); // "hello"console.log(padLeft("", 3, "0")); // "000"
Pads a string on the left with a specified character until it reaches the desired length.