11 ms·
JavaScript Errors: An Exceptional History
- dlbucci 7y agoI had no idea JavaScript shipped without Arrays. Too bad they didn't just let objects take anything as a key, like in Lua. Then you wouldn't have all the edge cases Arrays cause in JS. Oh well!
- gnode 7y ago> Too bad they didn't just let objects take anything as a key They do, except they get coerced to strings in whacky ways. Objects can be used largely like arrays, and Arrays are Objects, but Array is more suited for an ordered collection of numerically indexed elements, and so has relevant properties and methods, like length and indexOf.
- dlbucci 7y agoYeah, but the weirdness inherent to them being objects but also not objects leads to all sorts of bullcrap, like `Array.isArray` being a thing. I greatly prefer the Lua approach where you only have one map type (tables), and there are methods that allow you to easily use the tables as an array.
- rodinia 7y agoThis (anything can be a key) was eventually added with the Map class. They're an iterable type too, so they're much more useful than Objects imo. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- dlbucci 7y agoI agree! They are more useful! That's why I wish objects behaved that way to begin with!
- tdy_err 7y agoThe initial v1 JavaScript was written in about ten days: https://thenewstack.io/brendan-eich-on-creating-javascript-in-10-days-and-what-hed-do-differently-today https://thenewstack.io/brendan-eich-on-creating-javascript-i...
- z3t4 7y agoI remember that in IE all you got was a yellow alert sign in the status bar that there was a JavaScript error somewhere and you added alert boxes on every 100:ed line eg. alert("line 200") alert("line 220") until you had located the error. This is still how you do it on some mobile/tv browsers. Some browsers will not even tell you there is an error - and fail silently.
- icedchai 7y agoThis was the 90's Javascript debugging experience and why I still hate JS to this day. The language felt like mush.
- bagol 7y agoI feel bad for javascript for it always blamed for the fault of the environment where it lives.
- duxup 7y agoAnd to some extent the acts of bad actors using it. I just got into webdev a year or so ago and on HN and other places the moral panic about JavaScript on the web is endless because some jerks are out there doing it wrong and everyone thinks of their US local news website (those are a mess) when they talk about it ... and they want to throw the baby out with the bathwater. Meanwhile I'm just trying to write some handy web apps that do it right but can't escape the "omg javascript" medium type articles. I wonder if folks write some nasty stuff in C ... do people blame C?