padStart
padStart is a string method in JavaScript that pads the current string on the left with another string until the resulting length reaches the specified target length. It was introduced in ECMAScript 2017 (ES8) and is defined on String.prototype. The method returns a new string and does not modify the original.
Syntax: str.padStart(targetLength [, padString]). The parameter targetLength specifies the desired total length of the output string. If
Behavior: The padding string is repeated as needed and truncated to fit the remaining length. Before padding,
Compatibility and use: padStart is supported in modern web browsers and in Node.js environments that implement
Examples: '5'.padStart(3, '0') yields '005'. 'foo'.padStart(10) yields ' foo' (seven spaces). '123'.padStart(6, 'abc') yields 'abc123'.