title: Array Push uses the same index for the same value in JavaScript
body: <p>I just found out that using the function array.push(value) using the same value name, will give the same index of the first item with the same value name.</p>
  
  <p>Look at the example code following:</p>
  
  <pre><code>&lt;p&gt;Click the button to add a new element to the array.&lt;/p&gt;
  
  &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;script&gt;
  var fruits = ["Banana", "Orange", "Apple", "Mango"];
  document.getElementById("demo").innerHTML = fruits;
  
  function myFunction() {
      fruits.push("Orange");
  var orange_index = fruits.indexOf("Orange");
  document.getElementById("demo").innerHTML = orange_index;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>If you run it, you will notice that the answer is "1" , that corrisponds to the first "Orange" item inserted into the array.</p>
  
  <p>How can I avoid this behaviour ? I need to insert the same values into an array with different indexes.</p>
  
  <p>Do I need to use multidimensional array ?
  I have a deck of cards, and I need to store the ranks and suits in array. So far I created two different arrays for ranks and suits, but I'm having this problem. I retrieve the ranks and suits separately, should I push them together into a new multidimensional array? how ? </p>
  
  <p>Thanks</p>