x
 
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript String Methods</h2>
<p>Search a string for "mytat", and display the position of the match:</p>
<p id="demo"></p>
<script>
let text = "Visit mytat!"; 
let n = text.search("mytat");
document.getElementById("demo").innerHTML = n;
</script>
</body>
</html>