TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Web Truths: JavaScript can't be trusted

12 pointsby daviesgeekover 7 years ago

1 comment

masswerkover 7 years ago
&gt; &quot;JavaScript isn’t like CSS or HTML. Both these building blocks of the web are fault-tolerant. This means when you write invalid HTML, the browser tries to fix it. If you use bleeding edge CSS in an old browser, it ignores it. Not so with JavaScript.&quot;<p>This really isn&#x27;t a statement about the language, but about its use (and even more about frameworks). If your script breaks, your browser still happily displays the page as-is, if there&#x27;s a type error, the language tries to make the best of it (much to its criticism), there&#x27;s even a self-correction mechanism in the syntax (semicolon auto-insertion). If your first script silently and gracefully fails on an error, your other scripts will still execute (just like any other HTML tag). It really depends on the use, and the same criticism may be applied to, say, CSS:<p>E.g., we may come to the – rather amazing – conclusion that putting all the text content of a page into the content attributes of the before and after pseudo-classes is the only way to do it, because it&#x27;s a) a rather new feature, b) sexy, c) CSS is then your single source, and d) why not? Then, hey, CSS is now Turing complete, why not build an entire client-side framework on this? And, maybe, a headless CSS engine for the backend? And, boom, everything fails on a single malformed CSS expression...