Intro
When we build a website these days, there's a 110% chance that it's got some form of JavaScript on it. Whether it's a full framework, for animations, to trigger a popup or as a tracking script, JavaScript is all around us.
But what if I told you that you didn't have to use JavaScript at all? Not even as a build process? Thanks to updates in browser technologies, there's now a plethora of native browser features that allow building modern, functional websites, sans JavaScript.
So together, we'll build out a completely static website, a collection of HTML and CSS files, no tracking, no scripting, no servers, no third-party resources. Let's build a website the way we used to (but no marquees).
Why JS is the worst!
So many data breaches have been caused my malicious JavaScript. Having less of it would be better. There are $400 million dollars of data breaches because of JavaScript.
Scott Helme
HTML and CSS are far superior programming languages
Me
If all you have is a hammer, everything is a nail. People overcomplicate things that are easier with CSS because they think they JavaScript is the answer.
Anton Ball
JavaScript sucks because it's not CSS. It's complicated and makes our websites slower.
Mish Mannering
JavaScript sucks because it's powered by ADHD and bad coding practices.
Hannes Lowette
Still not convinced?
Why is HTML better than JS?
HTML functionality is built into browsers so most of the time if you can do something with HTML rather than loading in a bunch of JavaScript, you should.
Most HTML has much better browser support than JavaScript as well, and it's much easier to debug when something goes wrong.
Why is CSS better than JS?
CSS is built for styling and animation of our content and is much lighter-weight to use for dressing up our content than JavaScript. It can be parsed and rendered in our browsers much faster and when something goes wrong it fails more gracefully than JS which tends to break our entire page.
Why does JS suck so much?
- Performance Variability: JavaScript execution performance can vary widely across different browsers and devices. This can lead to inconsistent user experiences and require developers to optimize their code for various environments.
- Security Concerns: Because JavaScript runs in the browser, it's exposed to potential security vulnerabilities like cross-site scripting (XSS) attacks. Developers need to be vigilant about input validation and escaping to prevent these types of security breaches.
- Limited Debugging Tools: While modern browsers have improved their debugging tools, debugging complex JavaScript applications can still be challenging. Debugging errors in asynchronous code, for example, can be time-consuming and require specialized tools.
- DOM Manipulation Complexity: Manipulating the Document Object Model (DOM) using JavaScript can be error-prone and lead to performance issues. Frequent DOM updates can slow down the rendering of a web page, impacting the user experience.
- Dependency Management: Managing dependencies in JavaScript projects can become unwieldy due to the wide variety of libraries and frameworks available. This can lead to issues with compatibility, version conflicts, and increased project complexity.