3 ms·
I love JavaScript, but that HTMJS page has to be a joke. Putting that much JavaScript inside an inline onclick event attribute is pretty ridiculous. It's like a
by leptons 3y ago
I love JavaScript, but that HTMJS page has to be a joke. Putting that much JavaScript inside an inline onclick event attribute is pretty ridiculous. It's like a blog for how not to use JavaScript.
- simonklitj 3y agoIt seems you are right. The blog post reads “I've created HTMJS as a *sarcastic* way to express my thoughts.”
- simonw 3y agoSerious question: why is inline JavaScript like that a bad idea? It's easy to find the code that does something, easy to understand what it does and easy to modify it to do something else. Sure, I wouldn't want to maintain an app with thousands of lines of HTML and JavaScript that works like that, but for a single simple feature on a page that isn't doing anything else I don't see the problem.
- leptons 3y agoIf it is actually a simple bit of inline code, then sure. I mean not more than 2 commands maximum. Any more than that should be inside a <script> tag where it's far easier to write and format the code, debug, abstract, and reason about. The huge amount of code in the example on the HTMJS "blog" is just the worst way to write js code into a webpage because it is not a simple function, it's difficult to read, it won't have syntax highlighting because it's treated as a string.
- alexkutas 3y agoIt's properly highlighted in my IDE, which was actually a surprise.