Handlebars.js Loop for helper
If you just wanted to do something n times then:
Handlebars.registerHelper('times', function(n, block) { var accum = ''; for(var i = 0; i < n; ++i) accum += block.fn(i); return accum; });
and
{{#times 10}}
{{this}}
{{/times}}
If you wanted a whole for(;;) loop, then something like this:
Handlebars.registerHelper('for', function(from, to, incr, block) { var accum = ''; for(var i = from; i < to; i += incr) accum += block.fn(i); return accum; });
and
{{#for 0 10 2}}
{{this}}
{{/for}}
source: http://stackoverflow.com/questions/11924452/iterating-over-basic-for-loop-using-handlebars-js