title: How To Change Order Of Objects In Array
body: <p>So, I have a table of <code>statuses</code>. On this table of statuses I have a <code>foreign_key</code> representing the workflow that the status belongs to. 
  <a href="https://i.stack.imgur.com/8SD06.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8SD06.png" alt="enter image description here"></a></p>
  
  <p>Now my question is, <strong>looping through the list of statuses will put them in order of Id, but say I insert a new status and want it to be in certain location in the list not just added to the bottom</strong> how would i do that?</p>
  
  <p>Do I need to add an extra field that I could use to manipualte the order in which the statuses are printed out? </p>
  
  <p>This question is different from the one that it may be a copy of because, I am simply asking how to order array of objects if there is no unique identifier for order other than ID or an Index. I'm not looking for alphabetical or reversed. </p>
  
  <p>Say I have array of statuses coming from my database like so</p>
  
  <pre><code>[
    {id: 1, status: 'receive'},
    {id: 2, status: 'scan'},
    {id: 3, status: 'prepare'},
    {id: 4, status: 'review'},
    {id: 5, status: 'complete'},
  ]
  </code></pre>
  
  <p>And then I want to insert a new object however I want it to be 4th in the list but of course when I create the new status it will just use the next ID available... so the array would like this</p>
  
  <pre><code>[
    {id: 1, status: 'receive'},
    {id: 2, status: 'scan'},
    {id: 3, status: 'prepare'},
    {id: 4, status: 'review'},
    {id: 5, status: 'complete'},
    {id: 6, status: 'file'},// this being the new status created
  ]
  </code></pre>
  
  <p>So now when I return an array of all statuses how could I actually place the status 4th in list with the given properties available like so</p>
  
  <pre><code>[
    {id: 1, status: 'receive'},
    {id: 2, status: 'scan'},
    {id: 3, status: 'prepare'},
    {id: 6, status: 'file'},// this being the new order of statuses
    {id: 4, status: 'review'},
    {id: 5, status: 'complete'},
  ]
  </code></pre>