number = 1 converted = number.toString().padStart(3, '0') console.log(converted) // Expected output " 001 "