Find a sub string using search() function - Javascript String

Javascript examples for String:substring

Description

Find a sub string using search() function

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*www  .  java2  s.c  om*/
var url = 'http://localhost:3000/interests';
var url1 = 'http://localhost:3000/ideas';
console.log(url.search('interests'));
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials