Javascript examples for String:slice
Extract the characters from position 3 to 8:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* www.j a va2 s. co m*/ var str = "Hello world!"; var res = str.slice(3, 8); document.getElementById("demo").innerHTML = res; } </script> </body> </html>