How can I format an integer to a specific length in javascript?

How can I format an integer to a specific length in javascript?

More to explore

Based on this image's title: “How can I format an integer to a specific length in javascript?”