Javascript examples for String:substring
Begin the extraction at position 2, and extract the rest of the string:substring(2)
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w ww.ja v a 2s. c o m var str = "Hello world!"; var res = str.substring(2); document.getElementById("demo").innerHTML = res; } </script> </body> </html>