Searching Strings

<p id="output"></p>

<script>
    // Create a string
    var string = "The army will attack at dawn!";

    // Return the index of `string` where locate occurs
    var position = string.search("dawn");

    // Insert the position inside the HTML element with ID="output"
    document.getElementById("output").innerHTML = position;
</script>