padEnd()
ES2017+Pads the current string from the end with another string until the resulting string reaches the given length.
Syntax
string.padEnd(targetLength, padString)Parameters
targetLength number The length of the resulting string
padString string optionalThe string to pad with (default: space)
Return Value
string
The padded string
Examples
JavaScript
const str = 'abc';
console.log(str.padEnd(6, '123')); Output:
// 'abc123'