Prev Demo
Indexof() Method
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <p>Click the below button to know the output for an search which is not presented in an array.</p> <input type="button", onclick="myFunction()" value="Find"/> <p id="myId"></p> <script> function myFunction() { var a = ["France", "Darziling", "China", "Bangladesh", "Abudhabi", "Sharja"]; var b = a.indexOf("India"); document.getElementById("myId").innerHTML = b; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output