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