Change Content - Javascript

Change html element content using pure javascript author(s): Deepu Mohan Puthrote (WarFox)

HTML

<html>
<body>


<p>substr() extracts a part of a string:</p>

<p id="data"></p>



</body>
</html>

JavaScript

let text = "Hello world!"; 
let result = text.substr(7, 5);

document.getElementById("data").innerHTML = result;