Prev Demo
JavaScript
>
Array Indexof
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 position of India.</p> <input type="button" onclick="myPosition()" value="Find"/> <p id="myId"></p> <script> function myPosition() { var a = ["France", "India", "Darziling", "China", "Bangladesh", "Abudhabi"]; 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