I am currently writing some code wherein there are 8 different pieces of text that are repeated over 8 weeks. In other words, week 1 - text 1, week 2 - text 2... and so on. This then just cycles indefinitely every 8 weeks. Lets say I know this particular week is week 8 and that is important, and I want to make some code using JavaScript that would establish this cycle so that even in 15 years time or whatever, it would still give me the correct result.
I am struggling to think of how I might do this. My guess is that it would involve doing some maths with getTime()
to establish a number for exactly a week's worth of time, then somehow using this number plus the date from the start of this week to somehow establish a loop, that just keeps cycling through the eight texts. But I haven't really got the foggiest where I'd even start with this.
Any help would be greatly appreciated!
Via Active questions tagged javascript - Stack Overflow https://ift.tt/80kjd13
Comments
Post a Comment