Standard built-ins
String.prototype.padEnd()
Repeats and truncates filler at the end until the target length is reached; never truncates existing text.
Formal Syntax & Structure
javascript syntaxjavascript
text.padEnd(targetLength, [padString])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| targetLength | Number | Desired code-unit length. |
| padString | String | Filler, default space. |
Return Value
String
Padded text or original value.
Working Example
Example Snippetjavascript
console.log("1".padEnd(3,"0"));