3 ms·
Honestly, I don't like JavaScript, but this isn't a terribly good argument against it. There are many things to criticize about the language itself and its eco
by Mister_Snuggles 8y ago
Honestly, I don't like JavaScript, but this isn't a terribly good argument against it. There are many things to criticize about the language itself and its ecosystem, but the fact that it started as a client-side language is not one of them.
- type0 8y ago> There are many things to criticize about the language itself What are the main critiques of javascript? Genuinely curious, would like to hear from people that use or used it to build real projects.
- dx87 8y agoI haven't done any big projects with it, but I did use it for making a Firefox extension to archive sites. My biggest issue with it was the unpredictable way it would handle syntax errors, and how things were handled wasn't documented anywhere that I could find, you just kind of had to figure it out and remember for later. For example, depending on the function, passing the wrong number of arguments could 1). Cause the script to silently terminate 2).Cause the script to terminate with an error message 3).Execute the invalid function without mentioning the error, then return garbled output 4). Emit an error, skip the invalid function, but continue trying to execute the rest of the script. It was frustrating enough to turn me off using languages that don't have compile time type checking.
- gnfurlong 8y agoPassing the "wrong" number of arguments isn't a syntax error in JavaScript. If you pass fewer arguments than declared parameters, the rest are implicitly undefined. The variations you were seeing probably just came down to how the invoked function handled that undefined value. I can still understand how inconsistency in behavior there might be confusing.
- Mister_Snuggles 8y agoI don't use JavaScript very much, so keep that context in mind. As far as JavaScript the language goes, my biggest complaints are to do with the sparse standard library (leftpad should be something easy to do with built-in string formatting functions[0], not a 3rd-party library), unexpected behaviour (the map/parseInt thing[1] being one example), etc. The unexpected behaviour stuff is truly a case of needing to understand the language - after all, why should JavaScript behave like Python? However, as someone who doesn't use JS much, these bits of weirdness make it more difficult to use when I need to. [0] https://docs.python.org/2/library/stdtypes.html#str.rjust https://docs.python.org/2/library/stdtypes.html#str.rjust - this is a Python example, but why doesn't JS have this in its stdlib? [1] https://wsvincent.com/javascript-parseint-map/ https://wsvincent.com/javascript-parseint-map/
- spiralx 8y ago> 'foo'.padStart(20) < " foo" The fact that Array.prototype.map has different semantics from Python's map built-in, as most likely encountered by newcomers to JavaScript with the [...].map(parseInt) issue, is something that bit me once, maybe twice, before I adjusted to it - especially given that I'm more likely to use comprehensions than map in Python nowadays anyway. And the fact that the callback receives the index in JS is useful in far more situations than it causes problems, and it's certainly nicer than >>> [ callback(v, i) for (i, v) in enumerate(arr) ] when you want the index position.