Created
October 18, 2018 17:52
-
-
Save StrykerKent/188f6d8d0b421f8cdfb5b2299cc40a10 to your computer and use it in GitHub Desktop.
I was asked to iterate through each day from today to the first of this year and only print out date information for each Wednesday. I used pure JavaScript to do this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var now = new Date(); | |
for (var d = now; d >= new Date(new Date().getFullYear(), 0, 1); d.setDate(d.getDate() - 1)) { | |
if (d.getDay() == 3) { | |
console.log(new Date(d)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment