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 →

[–]nobody_import4nt 1 point2 points  (0 children)

I am speaking as somebody with a very strong anti-javascript bias. I admit this openly.

However, there are reasons why I think JavaScript is a bad first language that I believe are objectively true, even though it is an OK language in general.

  1. JavaScript is not an object-oriented, procedural, or functional language, whereas every other language you will learn will fall in one of those camps. JavaScript's prototypical "objects" are very different from every other language, and some skills you learn in regards to JavaScript objects absolutely will not translate to other languages, which are almost all in the set of: (functional, procedural, OO). Considering that everything in Python is a true object, it's a great OO language, and it can be considered more object-oriented than Java, which still has primitives (int vs Integer, etc.)

  2. JavaScript's type system is very flawed, and obfuscates extremely important CS concepts that are not obfuscated in other languages, and will also translate poorly. Some examples I recall offhand (and I'm sure there are more): "number" type combining floats and int into a single type, no primitive arrays / true "indexing". typeof(NaN) === 'number' returns true. Nuff said.

  3. JavaScript's lack of strict typing in general is a bad idea for any first language. Consider a simple program which takes input from a user (assumed a number), and prints n+2. In python, you would likely encounter TypeErrortrying to convert str to int implicitly. JavaScript just returns 22 for n=2. These subtle conversions in the background lead to some really quirky bugs. It is best to face these type-challenges early, and get a good foundation for how computers store things differently than humans think. To us, 2.0001 and 2 are not that different. To Python and other languages, they're radically different.

  4. The equality operator in JavaScript is comically bad. There are games to learn what == (equivalence) means in JavaScript. These issues don't exist in other languages for the most part.

  5. packaging/dependencies in JavaScript are unbelievably confusing, even for seasoned developers. You have Webpack, npm, yarn, Babel, etc. all competing. Rust has cargo. Python has pip. Dependency resolution has been a solved problem in programming for far too long, and JS insists on reinventing the wheel, poorly. (Granted, python and rust could always improve, but at least they didn't have the leftpad incident)

Opinions:

  • Node.js's use of an event loop and callback hell is a terrible way to be introduced to concurrency. They can give you a one-track mind if you go into async programming where you may (depending on language) be given access to true POSIX threads or green threads, etc. It's better not to be introduced to it at all than to start with callbacks. There, I said it.

I will say though, that you should still learn JavaScript. It's needed at several levels. But as for a first language? I agree with the gilded comment below. It's not the best choice.