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 padEnd() Method

The padEnd() method pads a string at the end.

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

let text = "5";
let text = numb.toString();
document.getElementById("demo").innerHTML = text.padEnd(4,"x");
Legend

number convert number to string new string