The web — and in particular the past few years JavaScript — is a moving target. Every time you think you know enough, there’s more to learn because it is changing and evolving. It plays to one of the things one of my earliest mentors told me back in the ‘80’s.
“The day you stop learning, is the day the world leaves you behind.”
There are a lot of good improvements, and a lot of really bad “changes for nothing.” I made the mistake of thinking that let/const were the latter, and honestly a lot of that stems from where and how people were using them. In eliminating the need for IIFE their purpose and advantage finally dawned on me.
Laugh is, I’m not even sure if I saw this someplace and then forgot about it, or if I just happened upon this on my own. I think it might be a little of both.
That the web is always changing is why sites like StackOverflow often end up with bad/outmoded or just plain wrong code. Because it MAY have been right at the time, or it at least provided a solution at a time where there was none. Old JS code ages… badly.
We used to use JS to patch holes in HTML, limitations of CSS, and even implementation woes within itself thanks to browser vendors who shall remain nameless dragging their heels.
Who are we kidding, nameless? It’s Microsoft, right?
Now those holes have been plugged, limitations eliminated, and woes largely a thing of the past. But because we ALL spent so long using JS as plaster paste filling holes and covering up nails, it’s what the majority of people dive for “the old way” without question.
And it certainly doesn’t help that the genuine improvements are poorly explained, poorly documented, and buried under a mountain of seemingly pointless changes that result in taking many steps backwards.
It’s also why despite my rabid distaste for the mental-huffing midgetry of things like Bootcrap, I applaud their decision five or six years ago to kick legacy IE to the curb by adopting flex as their primary model. That’s another article I’m working on right now in fact, how and when we really should tell legacy code to “Degenerate into something fool, I just got tired of doing what you told me to do. That’s the breaks boy, yeah…. That’s the breaks little man, break it down.”
And if you’re not down with that, I’ve got two words for ya!