<html> <body> <button onclick="var myS = new String('Sample String'); alert(myS.indexOf('String'));">string indexOf</button> </body> </html>