So I have tried this example from W3Schools and I get it.
function day() {
var day = new Date();
var week = new Array(
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
);
for (i = 0; i < week.length; i++) {
console.log(week[day.getDay(i) + 1]);
}
}
day();
The "+1" gets you tomorrows date, but what happens when you reach the end of the loop? Say today is Friday and I want to get three days out and Monday comes back as "undefined" because it is past the loop.
Is there any way to start the loop over? From what I've seen, continue/break doesn't work.
Any better suggestions on how to get today's date and the next few so that a loop doesn't break?