Many people think that JavaScript is bad, and using it on a website means you’re somehow bad. Personally, I don’t think that’s often the case.
Let me start by explaining why JavaScript has a bad reputation. You see, it’s a programming language that can be used to do all kinds of things on websites. These can range from benign uses, like formatting a hamburger menu on mobile devices, to more nefarious uses like browser fingerprinting.
The problem comes when web developers try bundle megabytes upon megabytes of JS into their websites. This can make websites extremely heavy and slow to load, which doesn’t sit well with me as I’m all about optimised websites.
Why is JavaScript bad
Let me just get one thing out there before we go any further – JavaScript is NOT inherently bad. The misuse of JavaScript is, however.
Anything can be misused badly. For example, a chainsaw is useful for all kinds of things – cutting back hedges, trimming trees, chopping fire wood. But ask the bloke below to tell you about his chainsaw antics and I’m sure you would have a very different opinion as to whether chainsaws are bad or not.
Woah. From JavaScript to the Texas Chainsaw Massacre. That escalated quickly, didn’t it! 😲
I use some JS on this website. It’s required for my guestbook and I use it for things like Lazy Loading and the great privacy respecting analytics service, Plausible. But if you were to disable JS and visit this site, the core functionality wouldn’t break.
Sure, you wouldn’t be able to post to my guestbook, but you would still be able to read all my content and my nav menu would continue working on all devices just fine. On the other hand, there are lots of sites out there that introduce bundles of JS into their code. To the point where their site is utterly dependant on JS, and in some cases useless without it.
If you were to disable JS on these sites, core functionality like the navigation menu may stop working. On other sites you wouldn’t even be able to see its content!
That’s where JavaScript becomes bad, folks.
JavaScript isn’t all bad
Personally, I don’t see the harm in using JS on your site in order to improve the user’s experience. But if your site is so reliant on JS that it wouldn’t function without it, that’s a problem.
Just so I make myself abundantly clear here – if you’re one of those people/companies that touts their intrusive tracking and fingerprinting as “improving our users experience,” you’re full of 💩.
What do you think? Has the world gone JaveScript mad, or is a little sprinkling of JS a good thing sometimes? Let me know your thoughts.
Is JavaScript Bad? Well, Only If You’re Using It Wrong is original content by Kev Quirk.
Top comments (0)