title: How to create an object depending on the last seven days?
body: <p>I have the following object:</p>
  <pre><code>[
      { createdAt: 6, numberofCreations: 3 },
      { createdAt: 7: numberofCreations: 2 },
      { createdAt: 2: numberofCreations: 6 },
      { createdAt: 3: numberofCreations: 3 },
      { createdAt: 4: numberofCreations: 1 },
      { createdAt: 1: numberofCreations: 2 },
      { createdAt: 5: numberofCreations: 1 }
  ]
  </code></pre>
  <p>Every number in the &quot;createdAt&quot; attribute represents a day of the week (1 for sunday, 2 for monday, 3 for tuesday, 4 for wednesday, 5 for thursday, 6 for friday and 7 for saturday). Every number in the &quot;numberOfCreations&quot; attribute represents how many elements were created that day of the week.</p>
  <p>What I need is to rearrange this and create a new object where the ids are organized according to the last seven days, and also, arranged in orderly.</p>
  <p>Meaning something like:</p>
  <pre><code>[2, 6, 3, 1, 1, 3, 2]
  </code></pre>
  <p>If you compare the second one with the first, you'll realize that this is organized depending on the day of the week.</p>
  <p>Is it possible to do this?</p>
  <p>Thanks in advance</p>