JavaScript padStart() MethodThe padStart() method returns a result string that achieves a predetermined length by padding a string with the other string starting at the beginning of the string. Once a string reaches the specified length, it can be padded with another string using JavaScript's padStart() method. The string's left end is where the padding is applied. SyntaxThe following syntax shows the javascript padStart() method and its input argument. Parameters: The two parameters that this method accepts are listed above and are described below:
Return Value: It provides the final string lengthened with the supplied string. Examples The following examples show the padStart() method and its javascript operation. Example 1 The example shows the padStart() method and its operation using the javascript function. The input value is less than the required pad length of the mehod. Output The image displayed padStart functions information as an output. Example 2 The example shows the padStart() method and its operation using the javascript function. The input value shows the difference between the "equal to", "less than," and "more than" the required pad length of the mehod. Output The image displayed padStart functions information as an output. Example 3 The example shows the padStart() method and its operation using the javascript function. Output The image displayed padStart functions information as an output. Web Browsers SupportedThe list of supported browsers for the padStart() method is as follows:
ConclusionThe padstart() method displays as output value per the required length. This method works for the data management functionality's string and object value size.
Next TopicJavascript promise chaining
|