4 ms·
I think the article missed an important “why” here that is confusing people here: JavaScript objects and the DOM are fundamentally different, and JavaScript is
by jacobsimon 2y ago
I think the article missed an important “why” here that is confusing people here: JavaScript objects and the DOM are fundamentally different, and JavaScript is providing an API via the DOM for reading and writing HTML, which is essentially an XML document. We shouldn’t expect the objects in JavaScript to perfectly translate to their HTML counterparts or vice versa.
If anything, it’s odd that they added these conveniences like reflection that make it more magical than it should be.
(Edited for clarity)
- naasking 2y ago> We shouldn’t expect the objects in JavaScript to perfectly translate to their DOM counterparts or vice versa. Since JavaScript was invented specifically to manipulate the DOM, I'm not sure that that follows.
- jacobsimon 2y agoThat's definitely one of the main original use cases, but it would have been a bad decision to base the entire language around the limitations of HTML, and I doubt JavaScript today would be the most popular programming language today if they had. You can read the original ECMAScript 1 standard here, which is titled: "A general purpose, cross-platform programming language"[1]. https://ecma-international.org/wp-content/uploads/ECMA-262_1st_edition_june_1997.pdf https://ecma-international.org/wp-content/uploads/ECMA-262_1...
- AmpsterMan 2y agoI think a lot of people dislike that JavaScript is a general purpose programming language, rather than being a scripting engine for browsers.
- wredcoll 2y agoA lot of people dislike any tool that actually has wide spread usage. No one complains about tools that have been abandoned.
- triceratops 2y ago"There are only two kinds of languages: the ones people complain about and the ones nobody uses." - Bjarne Stroustrop