<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Return Sub-string From a String in JavaScript</title>
<!--Script tag is added to write JavaScript code inside it-->
<script>
let originalString = "JavaScript";
let newString = originalString.substring(4, 10); //from index 4 to before 10
function myFunction() {
document.getElementById("outPut").innerHTML = `The new sub-string is: ${newString}.` ;
}
</script>
</head>
<body>
<h1>How to Return Sub-string From a String in JavaScript?</h1>
<button onclick="myFunction()">Click here to see result</button>
<p id="outPut"></p>
</body>
</html>