<!DOCTYPE html>
<html lang="en-US">
<body>
<script>
var myFruit = ["Apple", "Banana", "Cherry", "Apple"];
document.write("Index of Apple is - "+myFruit.indexOf("Apple")+"<br>");
document.write("Index of Apple is - "+myFruit.indexOf("Apple", 2));
</script> </body>
</html>