If I want to create an array containing a piece of data for every minute of the year (525,600 elements for 365 day year) or (524,160 elements for 364 day year) is there a way to create an array with a set amount of elements inside all set to a value of 0?
const minutesOfTheYear = [];
minutesOfTheYear[0] = 0;
minutesOfTheYear[1] = 0;
minutesOfTheYear[2] = 0;
/* ... */
minutesOfTheYear[525,599] = 0;
I think I could use a for loop, setting the amount of loops to 525,600 and the index of the array amended to add by 1 each time, but what is the proper way to declare the new values within a for loop? Would this work?
for (let i = 0; i< 525599; i++) {
minutesOfTheYear[i] = 0;
}
Or is there a line of code that just declares the size of the array and auto populates?