Change Content - Javascript

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

HTML

<html>
<body>


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

<p id="demo"></p>



</body>
</html>

JavaScript

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

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