Pad strings to a specific length:
let num = "42"
console.log(num.padStart(5, "0")) // "00042"
console.log(num.padEnd(5, "0")) // "42000"
let text = "hi"
console.log(text.padStart(10)) // " hi" (spaces)
The first argument is the target length. The second is the padding character (default is space). No change if the string is already longer.