loading
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const year = 2019;
const month = 10; // november, zero-indexed
const startDay = 14;

console.log('Array.from() example');
const dateList = Array.from({length:7}, (val, idx) => {
    return new Date(year, month, startDay + idx);
});

console.log('dateList = ', dateList, '\n');


console.log('for loop example');
const dateListAgain = []
for (let i=0; i < 7; i++) {
    dateListAgain.push(new Date(year, month, startDay + i));
}

console.log('dateListAgain = ', dateListAgain);