title: Find original index of reversed array
body: <p>I'm using the reverse() javascript function to reverse the objects held in a local storage array. But I'm trying to marry up the original index with the newly ordered array.</p>
  
  <pre><code>var fruits = ["Banana", "Orange", "Apple", "Mango"];
  fruits.indexOf("Apple"); //2
  var fruitsReversed = fruits.reverse();
  fruitsReversed.indexOf("Apple"); //1 -&gt; I want to know that it used to be 2
  </code></pre>
  
  <p>Is there an easy way to do this? My actual case is a bit more complicated because the original string is in JSON format:</p>
  
  <pre><code>var data = {"info":[{"name":"Max"},{"name":"Alex},{"name":"Sam"},{"name":"Chris"}]}
  </code></pre>
  
  <p>...but I don't know if that would make a difference.</p>
  
  <p>Update: I've got this working using using a bit of a work-around:</p>
  
  <pre><code>var fruitsLength = fruitsReversed.length-1; //3. subtract one because the first index is 0, not 1
  var fruitIndex = fruitsLength - fruitsReversed.indexOf("Apple"); //2 (3-1)
  </code></pre>
  
  <p>So while this works, I think there must be a cleaner way...</p>