Javascript examples for String:startsWith
Check if a string starts with "world", starting the search at position 6:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//w w w .ja v a2 s . c om var str = "Hello world, this is a test."; var n = str.startsWith("world", 6); document.getElementById("demo").innerHTML = n; } </script> </body> </html>