how to add space to a string by a certin number in javascript using replace method how to add a substring to a certain space in a string javasript add text to string in specific index js add a char at index in string js add a charicter to a specific locationin a string js add a space at specific position string react natice add char at index 3 js There are multiple ways to display text on a web page in JavaScript, the easiest is: document.write (" Text to display. Find centralized, trusted content and collaborate around the technologies you use most. The gap between each line will then be the font size multiplied by the number you specified, which in this case is 2. Using this Property, you can specify a negative, positive or normal value for the length between word spaces.