Sort object with keys (JS) : <p>Have Object. look like this</p>

<p><a href="https://i.stack.imgur.com/OBxaT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OBxaT.png" alt="enter image description here"></a></p>

<p>need to sort it, in result: mo,tu,we,th,fr,st,su</p>

<p>try do this but not working</p>

<pre><code>const sortOrder = {'mo': 1, 'tu': 2, 'we': 3, 'th':4,'fr':5, 'sa':6, 'su':7}
      const res = result.map(o =&gt; Object.assign({}, ...Object.keys(o).sort((a, b) =&gt; sortOrder[a] - sortOrder[b]).map(x =&gt; { return { [x]: o[x]}})))
</code></pre>
