JavaScriptStringpadEnd

Pads the current string with a given string at the end.

Syntax

str.padEnd(targetLen, padStr?)

Example

Enter values below to update the example in real time.

const
code
console
padEnd
const code = "42";
console.log(code.padEnd(5, "0"));    // "42000"
console.log(code.padEnd(5));         // "42   "