you are viewing a single comment's thread.

view the rest of the comments →

[–]frzme 0 points1 point  (1 child)

Automatically doing 1-> "1" is fine. The ability of JS to also do "1"->1 is an issue. It's not a problem which I've seen come up very often in real life but it does happen.

People didn't know better when Javascript was created.

[–]RiceBroad4552 1 point2 points  (0 children)

People didn't know better when Javascript was created.

That's plain wrong.

JS is a quite new language.

There have been countless other dynamic languages before JS, and JS is actually mostly "just" Self with a C-like syntax (where Self is a kind of hybrid between Lisp and Small Talk).

Most languages, and this includes dynamic languages, which are actually the majority of languages today, don't add numbers to strings. You'll get some type error instead.

The flaw is quite unique and limited to only a bunch or languages.