String.prototype.padEndintermediate'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.
If the fill string is longer than needed, it is truncated.
'ab'.padEnd(5, 'XYZ') β 'abXYZ' (fill truncated to exactly fit)
'ab'.padEnd(6, 'XYZ') β 'abXYZX'
Challenge: Implement padPattern(str, len) that pads with '123'.
padPattern('ab', 7) // β 'ab12312'