title: Javascript : sorting an object by child object given key value
body: <p>How to sort an object by a given value of its child keys ?</p>
  <p>For instance, this object:</p>
  <pre><code>{
      &quot;a&quot;: {
          &quot;name&quot;: &quot;Edward&quot;,
          &quot;value&quot;: 21
      },
      &quot;b&quot;: {
          &quot;name&quot;: &quot;Sharpe&quot;,
          &quot;value&quot;: 37
      },
      &quot;c&quot;: {
          &quot;name&quot;: &quot;And&quot;,
          &quot;value&quot;: 45
      },
      &quot;d&quot;: {
          &quot;name&quot;: &quot;The&quot;,
          &quot;value&quot;: -12
      },
      &quot;e&quot;: {
          &quot;name&quot;: &quot;Magnetic&quot;,
          &quot;value&quot;: 13
      },
      &quot;f&quot;: {
          &quot;name&quot;: &quot;Zeros&quot;,
          &quot;value&quot;: 37
      }
  }
  </code></pre>
  <p>would become sorted by the &quot;value&quot; key of its child objects:</p>
  <pre><code>{
      &quot;d&quot;: {
          &quot;name&quot;: &quot;The&quot;,
          &quot;value&quot;: -12
      },
      &quot;e&quot;: {
          &quot;name&quot;: &quot;Magnetic&quot;,
          &quot;value&quot;: 13
      },
      &quot;a&quot;: {
          &quot;name&quot;: &quot;Edward&quot;,
          &quot;value&quot;: 21
      },
      &quot;b&quot;: {
          &quot;name&quot;: &quot;Sharpe&quot;,
          &quot;value&quot;: 37
      },
      &quot;f&quot;: {
          &quot;name&quot;: &quot;Zeros&quot;,
          &quot;value&quot;: 37
      },
      &quot;c&quot;: {
          &quot;name&quot;: &quot;And&quot;,
          &quot;value&quot;: 45
      }
  }
  </code></pre>