Here is the code:
<h2>Get the length of Substring</h2>
var str = "Hello World";
var sub= str.substr(0,4);
document.writeln("The substring is :"+ sub+"<br>");
document.writeln("The length of the substring is :"+ sub.length);
Output will be displayed as:
Ask your questions, our development team will try to give answers to your questions.