Skip to content

Instantly share code, notes, and snippets.

@vastus
Created October 27, 2015 09:06
Show Gist options
  • Select an option

  • Save vastus/1649753e9521b12bbaf0 to your computer and use it in GitHub Desktop.

Select an option

Save vastus/1649753e9521b12bbaf0 to your computer and use it in GitHub Desktop.
var a = [0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 6]
var wday = 3;
console.log('wday', wday);
for (var i = 0; i < a.length; i++) {
console.log('i',((a[i] + wday) % 7));
}
/*
* Output:
* i 3
* i 3
* i 4
* i 4
* i 4
* i 5
* i 5
* i 6
* i 0
* i 1
* i 1
* i 2
* i 2
* i 2
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment