This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.

Smartphone icons created by Freepik - Flaticon

JavaScript Strings

The padStart() Method

The padStart() method pads a string from the start.

It pads the string with another string (multiple times) until it reaches a given length.

let text = "5";
document.getElementById("demo").innerHTML = text.padStart(4,"x");