var string = "Hello world!";
var n = string.search("w"); //now n equals 6
'a nice string'.indexOf('nice') !== -1 //true
'a nice string'.indexOf('nice', 3) !== -1 //false
'a nice string'.indexOf('nice', 2) !== -1 //true
"I love cats".indexOf("cat") //returns 7, the position of "cat"