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