title: Javascript sort object by second value
body: <p>I have the following object:</p>
  
  <pre><code>Object {
    "1468": "Test Prop",
    "1647": "TEST 1",
    "1820": "ABC",
    "1840": "Gio"
  }
  </code></pre>
  
  <p>I would like to order by the second property. It would be:</p>
  
  <pre><code>Object {
    "1820": "ABC",
    "1840": "Gio",
    "1647": "TEST 1",
    "1468": "Test Prop"
  }
  </code></pre>
  
  <p>How can I do it in Javascript?</p>
  
  <p>I received the data in an array:</p>
  
  <pre><code>Array [
    Array [
      1820,
      "ABC",
    ],
    Array [
      1840,
      "Gio",
    ],
    Array [
      1647,
      "Test 1",
    ],
    Array [
      1468,
      "Test Prop",
    ],
  ]
  </code></pre>
  
  <p>It is already ordered, but when I create my object I lost the order:</p>
  
  <pre><code>const myObj = {};
  for (let index = 0; index &lt; data.length; ++index) {
     const value = data[index];
     myObj[value[0]] = value[1];
  }
  </code></pre>
  
  <p>Thanks</p>