4 ms·
I 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 standar
by Mister_Snuggles 8y ago
I 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.