3 ms·
So in summary: JS map doesn't behave like anybody else's map. JS argument passing prefers doing the wrong thing to interrupting the programmer. These two thi
by JulianMorrison 7y ago
So in summary:
JS map doesn't behave like anybody else's map.
JS argument passing prefers doing the wrong thing to interrupting the programmer.
These two things conspire together and poor parseInt does its best with the resulting garble.
- horsawlarway 7y agoI don't really see any issue here. JS map behaves sanely - It adds extra params, but I've had them be useful every now and then, and I've never had them cause a problem. Arguments behave... Like arguments behave in JS. Arguments have ALWAYS been variadic and accessible through the "arguments" variable within a function. That's not the "wrong" thing, it's just a thing. If you want named arguments - put them up top. Otherwise you'll get an array-like with everything passed. This is entirely consistent with the language. Finally - These two things conspire together to do what exactly? This isn't a subtle bug where it works correctly 99% of the time and blows in prod late on a friday. This is an obvious error with even dead simple test cases that clearly show the dev has messed up. Unit test your shit, or hell, just run it once or twice before using it and you're fine. --- Basically - you should know how your std library works. That includes JS. I think this is pretty trivial. Worse, I actually find this behavior far more intuitive than something like ConfigureAwait(false) in C#, for example.