Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

See my comment below. It's not about being trapped in any mindset. It's about thinking logically.

Either '5' - 3 results in an error of some kind, or it evaluates to 2. There is no other logical outcome. Javascript chooses to do the latter.

I also disagree that starting language matters. It's like saying you need to have a steinway grand to learn the piano properly.

Learning is about learning what not to do just as much, if not more, than what to do.

Also if you learn to swim through syrup, imagine how fast you'll be when you try swimming through water...



Your ideas about what is "logical" are completely arbitrary. Look, I can make up rules too:

* '5' - 3 should return '5', since it's the string '5' minus all the instances of the character '3' in it. There is no other logical outcome!

* '5' - 3 should return an empty string, since it's the string '5' with the last three characters removed. There is no other logical outcome!

* '5' - 3 should return '2' -- since we started with a string, the result should turn back into a string. There is no other logical outcome!

* '5' - 3 should return 50, since the only logical way to do math on a character is to take the UTF-8/ASCII value of it and then do the math. There is no other logical outcome!

* '5' - 3 should return undefined, since subtracting from a string typically doesn't produce a reasonable result. There is no other logical outcome!

You have provided absolutely no rational basis for discriminating between the merits of these choices, so your claim that Javascript's choice is one of exactly two "logical" ones is bizarre. If you think Javascript's choice is better, give a reason why it's better, don't just say that it's better.


The time wasted learning the quirky semantics and special rules covering each operator and data type in JavaScript could be better spent learning to reason about algorithms and data structures in a less confusing language. Not all learning is equal, and not all challenges are exactly the same.

The claim that by hindering a newbie programmer's attempts to express themselves will make them more effective in a better language is ridiculous. Even if it's true, it's missing the point - your goal when teaching newbie programmers should be to teach them good habits and generally applicable skills, and most importantly, you want them to love programming.

Having to memorize arcane minutiae and spend tons of time debugging problems caused by stupid design decisions is not going to make people love programming. JavaScript is tremendously accessible by virtue of its ubiquity, but that does NOT implicitly make it a good language for learning to program. Its numerous flaws and divergent implementations will drive away beginning programmers that might otherwise learn to love programming if presented with a better environment.


Please do not downvote maximusprime's comments just because you disagree with them.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: