HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Click the button to return the position where the carriage return character was found in a string.</p> <button onclick="myFunction()">Click me</button> <p id="point"></p> <script> function myFunction(){ var str = "H\ris style Is Who is he IS"; var pattern = /\r/; var result = str.search(pattern); document.getElementById("point").innerHTML = result; } </script> </body> </html>
OUTPUT
×

Save as Private