Finding the index position of an array : <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var cars = ["BMW", "BENZ", "LAMB", "AUDI"];
var abc = cars.indexOf("BMW");
document.getElementById("demo").innerHTML = abc;</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p id="demo"&gt;&lt;/p&gt;</code></pre>
</div>
</div>
</p>

<p>This is the code where it displays the position but I want reverse of this that is if I enter a position it should display the array value. How to get that?</p>
