<!DOCTYPE html> <html> <body> <h1>JavaScript Methods</h1> <p>Search a string for "Community", and display the position of the match:</p> <p id="workingcode"></p> <script> var text = "WorkingCode Community!"; var n = text.search("Community"); document.getElementById("workingcode").innerHTML = n; </script> </body> </html>
Output
JavaScript Methods
Search a string for "Community", and display the position of the match:
12
Search a string for "Workingcode", and display the position of the match JavaScript?
admin Changed status to publish December 19, 2023