<!DOCTYPE html>
<html>
<body>

<p id="myP">This is an example paragraph.</p>

<button type="button" onclick="myFunction()">Set word spacing</button>

<script>
function myFunction() {
    document.getElementById("myP").style.wordSpacing = "50px";
}
</script>

</body>
</html>