×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Massimo Zappino
Added: Nov 10, 2011 1:38 PM
Views: 32
  1. var myString = "Hello world!";
  2. var mySubstring = "world";
  3.  
  4. var found = myString.indexOf(mySubstring) == -1 ? false : true;
  5.  
  6. // indexOf() returns -1 if no occurrence was found