Online HTML Editor
Javascript Online Compiler
index.html
Change Theme
Compress code
Uncompress code
Download Code
Clear Code
Copy Code!
RunĀ
Click to run or ctrl+s
Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Article - JavaScript lastIndexOf method 3</title> </head> <body> <h2><code>lastIndexOf</code> method: used to check last occurance of a substring within a string.</h2> <p>Press <kbd>F12</kbd> to open the console and see the output of the program.</p> <script> const str = "To do or not to do"; console.log(str.lastIndexOf("To")); // 0 console.log(str.lastIndexOf("to")); // 13 </script> </body> </html>
RunĀ