JS Built-ins
StringString.prototype.padEndintermediate

String.prototype.padEnd() β€” fixed-width table formatting

πŸ“– Usage Example
'5'.padEnd(3, '0')       // β†’ '500'
'hello'.padEnd(8, '-')   // β†’ 'hello---'
'hi'.padEnd(2)           // β†’ 'hi'

Use padEnd() to pad the end of a string with a fill character until it reaches the target length.

String.prototype.padEnd() β€” Fixed-Width Formatting

.padEnd() is useful for aligning text in fixed-width columns.

Challenge: Implement formatRow(label, value) that left-aligns a label in a 15-character field and appends the value.

formatRow('Name', 'Alice') // β†’ 'Name           Alice'
πŸ’‘ Hints (1)
  • β€’ `label.padEnd(15)` ensures the label takes exactly 15 characters.