looping a variable with dynamic incremental number
Hi guys!
I'm looking for a way to just use one row for variables.. This stuff works, but I guess I should write this more effective?
var H1 = moment.unix(data.hourly.data[0].time).format("HH");
var H2 = moment.unix(data.hourly.data[1].time).format("HH");
var H3 = moment.unix(data.hourly.data[2].time).format("HH");
var H4 = moment.unix(data.hourly.data[3].time).format("HH");
var H5 = moment.unix(data.hourly.data[4].time).format("HH")
what I want is to learn a way to incredemental count numbers..
x should start from 1 and can be up to some high number..
y always starts from 0 and its coming by jSON so this should be repeating like the above.. from 0 to 24. I need a stop after 24, date data sources have 48, but I want to stop after 24.
var H(x) = moment.unix(data.hourly.data[y].time).format("HH");
would be great to see a reply!
Thanks