Skip to content

Instantly share code, notes, and snippets.

@mklabs
Created October 13, 2010 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mklabs/623995 to your computer and use it in GitHub Desktop.
Save mklabs/623995 to your computer and use it in GitHub Desktop.
// BONUS: what is the faulty logic in the following code? how would you fix it?
var date = new Date(),
day = date.getDate(),
month = date.getMonth(),
dates = [];
for (var i = 0; i <= 5; i++) {
dates.push(month + '/' + (day + i));
}
console.log('The next five days are ', dates.join(', '));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment