Substring-2

 

Example of JavaScript substring function without second parameter:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p>Click the button to extract characters from the string. <br/> Original string : i love learnkode </p> <button onclick="extractSubset()">Show the substring</button> <p id="sample"></p> <script> function extractSubset() { var str = "i love learnkode"; var result = str.substring(2); document.getElementById("sample").innerHTML = result; } </script> </body> </html>
Output