JavaScript search() Function Example

JavaScript String search() function search the string into given string.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>JavaScript str.search() function</title>
</head>
<body>
    <script type="text/javascript">
        var str="Visit Wikipedia.org";
        document.write(str.search("Wikipedia.org"));
    </script>
</body>
</html>

Run it...   »

Example Result