SOURCE

function getDay(day) {
    var today = new Date();
    var dateArr = []
    for (var i = 0; i < day; i++) {
        // var targetMilliSeconds = today.getTime() + 1000 * 60 * 60 * 24 * i;
        // today.setTime(targetMilliSeconds);
        var newDate = new Date(today.getTime() + 24 * 60 * 60 * 1000 + 1000 * 60 * 60 * 24 * i);
        var year = newDate.getFullYear();
        var month = newDate.getMonth() + 1;
        var date = newDate.getDate();
        var week = newDate.getDay();
        var weekStr = ["周日","周一","周二","周三","周四","周五","周六"];
        var fullDate = year + '/' + (month >= 10 ? month : "0" + month) + '/' + (date >= 10 ? date : "0" + date) + ' ' + weekStr[week]
        dateArr.push(fullDate)
    }
    return dateArr
}

console.log(getDay(7))
console 命令行工具 X clear

                    
>
console