Prev Demo
Indexof Method In Javascript
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <p>Click the below button for searching the character of a string</p> <input type="button" value="Search" onclick="Function()" /> <p id="myId"></p> <script> function Function() { var a = "Loop is used to repeat a code block till a certain condition is true."; var r = a.indexOf("i", 12); document.getElementById("myId").innerHTML = r; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output