String.prototype.padStartbeginner'5'.padStart(3, '0') // β '005'
'hi'.padStart(5, '-') // β '---hi'
'hello'.padStart(3) // β 'hello'Use padStart() to pad the beginning of a string with a fill character until it reaches the target length.
Without a second argument, .padStart() pads with spaces.
Challenge: Implement rightAlign(str, width) that right-aligns text by padding with spaces.
rightAlign('42', 6) // β ' 42'