How to set the spacing between words in a text in JavaScript?

JavascriptObject Oriented ProgrammingFront End Technology

Use the wordSpacing property in JavaScript to set the spacing between words.


You can try to run the following code to learn how to implement wordSpacing property −

<!DOCTYPE html>
         <p id = "pid">This is an example paragraph.</p>
         <button type = "button" id="btn" onclick = "display()">Set Space</button>
            function display() {
               document.getElementById("pid").style.wordSpacing = "25px";
Published on 27-Feb-2018 10:29:09