[Solved] fix results of javascript loop


Use 48 iterations instead of 24. Then you can use i%4 as the index into an array of minutes for the quarter hours.

<% var arrayOfTimes = []; %>
 <% for (var i = 0; i <= 48; i++) { %>
   <% var n = Math.floor(i/4) + [":00", ":15", ":30", ":45"][i%4]; %>
   <% if(n<10) %>
       <% n = ''+n; %>
   <% arrayOfTimes.push(n); %>
   <% console.log(arrayOfTimes); %>
<% } %>

1

solved fix results of javascript loop