Javascript - the bad part/habits (split thread)

What’s a bad habit required by JavaScript that one must unlearn later? This will be helpful to me so I can undo my bad habits.

Regardless, no language in 2016/17 is as ubiquitous and powerful as JavaScript. One can build “native” iOS/Android (React Native), Windows/MacOS (Electron), web, and of course program a server (Node) with one language. No other (high level) language can come close to that claim.

Well you can’t write hardware drivers with JS as far as I remember, but you still can do all you mentioned and for example drivers with C. So C is at least one language that is more powerful than JS.

And in my personal opinion writing desktop apps with JS and electron is some kind of cruel joke. Those app tend to eat order of magnitude more RAM than native desktop solutions.


I wouldn’t call Visual Studio Code or Atom “cruel jokes”, but perhaps you have a higher standard than I do.

You can do everything with MIPS. That’s not the point. Point is there’s no high level language that can work in so many different domains.

Recommending JavaScript to a beginner is almost as recommending him to learn the BrainFuck language, ok… maybe it’s not that bad, but definitely not recommended for a beginner.

A good programming language for a beginner is Ruby, Python or even Elixir. A beginner will not be very interested in all the awesome patterns and super powers of a language, but they will be interested in how easy and fun it is to write code in that language.

JavaScript is boring and dull, especially with so many brackets and callbacks. And for most beginners E6 wouldn’t be suitable, so they will be forced to write function() and var thousands and thousands of times. Definitely not suited for a beginner.

Python, and Ruby, is far more suitable for a beginner because of it’s easy-to-understand syntax and versatility. Elixir is also a very fun programming language to learn as a beginner, especially since you won’t have to get rid of OO mentality later on, with a good understanding of functional programming a beginner could easily jump to Scala, in a year or two, if they don’t find a job where they can work with Elixir.

1 Like

So because there are braces and callbacks, function, and var, it’s not suitable for a beginner?

I think the most difficult thing is the event loop and understanding how code executes in the various JS contexts. Perhaps that’s not beginner friendly, but it has helped me (loosely) understand GenServer.

1 Like

Please read it in the context i wrote it in. Fairly big rails app open in code = 9 processes with ~230 MB ram usage. SublimeText3 = 2 processes with ~22 MB ram usage. Rubymine (but it’s a proper IDE, not a just a fancy text editor) with 2 big projects open 200-400 MB. I don’t even try to count Atom, because it has much more ram usage then Code. So yeah, Atom or Code… or maybe rather Electron is a cruel joke. End user costs for the ease of development are much too high.

Ane when it comes to bad practices is not braces, but callback hell for sure. Well not even the callbacks themselves, but in almost every app i had to work with, or read it’s code people have terrible habit of inlining as anonymous function every damn callback… it’s really a hell. You can write readable JS code but language itself does not help you with that and don’t and community does not either.

Also because of how language is designed, most of errors is undefined, instead of really meaningful ones, and that must be really newbie friendly…

JavaScript simply allows you to make whatever you want in whatever way you choose, without even trying to teach user best practices. Community is so fragmented, that you have even more JS style guides than languages I ever wrote in :smiley:

It’s not that I hate Javascript, but simply there is so little to like in JavaScript :confused:


For whatever it’s worth, I have both VS Code and Sublime open with comparable files. Code is using 67.1MB, Sublime Text 3 85.8MB. Idle CPU both negligible. Obviously everyone’s mileage will vary… I don’t discount your experience, but I’ve found both VS Code and Atom to be performant. I prefer VS Code over Sublime. And like you, I also use IntelliJ (WebStorm).

I take your criticism that Javascript is too unstructured. However, callback hell shouldn’t exist for modern code (with ES6 native promises, or even better, Reactive Extensions… Observables should appear in ES7), but it is rampant in legacy code. I’d also concede that its event loop adds beginner complexity.

I suppose we’re arguing past each other. I find Javascript’s ubiquity and versatility empowering to the beginner. You prefer the more prescriptive and opinionated languages for starters. I think there’s merit in both.

1 Like

Off the top of my head - - and I don’t pretend to know JS well–one thing is the tendency of novice JS devs to not pay attention to the difference between == and ===. As I say that’s just one that comes to mind. I am sure others more familiar with JS can come up with a few more.

1 Like

You can use TypeScript which is actually a better option than plain JS. The issue with JS is a lot of quirks from coercion rules to bugs like typeof(null) returning object that can not be fixed as it will break a lot of code (and on and on). So basically you will need to dedicate a good chunk of time to learning all the quirks and gotchas.

If all you have is a hammer, everything looks like a nail.

This what makes javascript so tiring and fatiguing.


eval. Considering everything as a string. The == vs === thing. Silent erroring and trying to save everything by coercing.

Etc etc. In general, JS advantage for a “beginner” is that it has easy visual feedback. Outside of that… i don’t know. I still advise for Python, a Lisp or a ML as a first language. Then probably a bit of C. Not a lot, but enough to grasp the idea of a reference/pointer and the difference between stack and heap.

But yeah JS has warts. It is due to its history. We have to deal with it. It is how it is. It is not a really bad first language, and it gives instant visual feedback… And it helps to make money fast. So it can makes sense.

But JS, the “bad parts” tends to spiral the beginners towards “programming is super hard or hacky” fast.


I don’t pretend to be a language expert, but my limited experience, most comparison operators in dynamically typed languages have == vs ===.

1 == 1.0 // true
1 === 1.0 // false

But I obviously concede that Javascript’s coercion goes well beyond Elixir’s and can be the source of much confusion.

JS has language quirks… but it has more quirks for experienced programmers. English also has maddening quirks… for non-native speakers. That doesn’t mean English isn’t a good first language. I think the frustration with Javascript may be, in part, from those bringing their programming luggage to JS.

I know a lot of people hate JS, but dont let the hate blind you.
As a self taught programmer myself I will tell people new to web programming to learn Javascript first(or in conjuction with other), because one way or another you will use them somewhere in the middle of the tutorial/learning resource

1 Like

Have you had a chance to work with Elm and Cycle? I’m curious what Elixir developers think of the Elm framework and Cycle’s management.

Reopened after thread clean up

Sadly it looks like those are being phased out from what I’ve seen, which saddens me… :frowning:

The elm style I quite like, hence why I ported it to a better language, OCaml. :wink:
Cycle looks interesting, thought of playing with it sometime, elm’y as well but more verbose.

1 Like

Are you sure? - there seems to be constant confusion between the Object.observe proposal which has been in fact deprecated and Observables. Given that Observables are a generalization of Promises it would seem silly to axe them.

The discussion that started the confusion was all about Object.observe().

Hmm, perhaps… Cool. :slight_smile: