lastIndexOf() : Find last occurance of the value inside string in JavaScript
JS Script :
<html> <body> <script type="text/javascript"> var str="Pritesh Taral"; document.write(str.lastIndexOf("r") + "<br />"); document.write(str.lastIndexOf("TARAL") + "<br />"); document.write(str.lastIndexOf("Taral")); </script> </body> </html>
output in Browser :
10 -1 8