you are viewing a single comment's thread
view the rest of the comments
[–] 1 point 4 days ago (2 children)

Then don't use JavaScript. This functionality is intentionally baked in to the design of the language. It was literally designed to do exactly this. I think it's dumb too, but my solution isn't to expect the language to act against its design, it's to use a strongly typed language.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 3 points 3 days ago

    I don't really understand how dumb it is to set a wide default type casting. Yet I understand the point of requesting declared casting for some language (when the language is designed to be used by a team of professional dev).

    But for languages that aim to be accessible to simple users for personal home pages, with html and css, is it really dumb? May it let mistakes pass without crash the remaining of the script, but it seems acceptable to me in some amateur pages.

    If the script is written by a single dev, or a small team, they may decide to only use explicit casting and strict rules for their code...

    I think the main mistake is to take javascript for an "easy little language one may use without learn it" just because it is made to be usable by non-professionals. But I could be wrong, and I would gladly understand how wrong I am…

  • source
  • parent