title: How to create an hours + minutes array with moment.js and ES6?
body: <p>I'm trying to create an array of hours in a day with 30 minute intervals with moment.js and ES6.</p>
  
  <p>Example:
  <code>let hours = ["12:00 AM", "12:30 AM", "1:00 AM", "1:30 AM", ..., "11:30 PM"]</code></p>
  
  <p>I already have this <code>for</code> function:</p>
  
  <pre><code>someFunction () {
    const items = []
    for (let hour = 0; hour &lt; 24; hour++) {
      items.push(moment({ hour }).format('h:mm A'))
      items.push(moment({ hour, minute: 30 }).format('h:mm A'))
    }
    return items
  }
  </code></pre>
  
  <p>But I would like to make it more ES6-like.</p>
  
  <p>I have gotten this far:</p>
  
  <pre><code>someFunction () {
    let timeSlots = new Array(24).fill().map((acc, index) =&gt; {
      let items = []
      items.push(moment( index ).format('h:mm A'))
      items.push(moment({ index, minute: 30 }).format('h:mm A'))
    })
    return timeSlots
  }
  </code></pre>
  
  <p>But it outputs:</p>
  
  <p><code>["1:00 AM", "12:30 AM", "1:00 AM", "12:30 AM", "1:00 AM", "12:30 AM", "1:00 AM", "12:30 AM", "1:00 AM", "12:30 AM", "1:00 AM", "12:30 AM", ...]</code></p>