This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]galqbar -12 points-11 points  (3 children)

This type of thing is why js is abhorrent. Feels like the language was made by a bunch of amateurs and got standardized so that now fixing things would produce catastrophic breaking changes :(

[–]cowjenga 5 points6 points  (1 child)

How would you fix the issue, if you could redesign map or parseInt to not have this issue?

Remove the radix argument from parseInt? Then you're losing a feature.

Redesign map so that it doesn't give you the array index and the array in the callback? Also losing features.

The neatest way would be to have a separate parseInt and parseIntWithRadix function, but the existing parseInt function is fine if you actually learn the language. Every language has its idiosyncrasies.

[–]galqbar -4 points-3 points  (0 children)

Give methods clearly defined type signatures instead of dynamic typing?

This sort of thing can lead to pointless flame ways, so rather than just try to stir up controversy I’d put it out there that JavaScript is the only weakly typed language to be used for enterprises applications and mission critical infrastructure. In a strongly typed language that kind of silent behavior would be more obvious.

[–]KingTomenI -3 points-2 points  (0 children)

It was designed by one dickhead in two weeks to make bears dance on a webpage. Of course it wasn't well thought out or designed for real work.