[Solved] Javascript Generate Array of Hours in the Day Starting with Current Hour [closed]


Pretty straight-forward. See comments inline:

var result = [];                      // Results will go here
var nowHour = new Date().getHours();  // Get current hour of the day

// Loop from current hour number to 23
for(var i = nowHour; i < 24; i++){
  result.push(i + "00");  // Put loop counter into array with "00" next to it
}

console.log(result); // show results

2

solved Javascript Generate Array of Hours in the Day Starting with Current Hour [closed]