I finally worked out how
setInterval works and why it doesn’t play well with
for loops. After a few false starts, this was the first time I actually sat down and wrote a function out in pseudocode before starting on the js.
Please feel free to reuse, remix, borrow, or steal! (Within the bounds of the MIT license, as it’s hosted on CodePen).
Comments, criticism, and suggestions are also welcome!
What if you just used an animated .gif graphic for the blinking cursor? That way, you don’t have to control it’s blink in your JS.
Yeah, that’d have the advantage that you could set a blink rate that wasn’t an exact number of
clockTicks, though it’d also be less customizable on the fly.
I assume there are also ways you could do it with pure CSS, too, though I haven’t yet learned how.