Don’t Learn JavaScript as Your First Programming Language

Don't learn JavaScript as the first programming language

JavaScript is a great programming language. One of the most powerful ones and one of the most trending ones. Everybody talks about JavaScript, and everybody learns JavaScript today.

JavaScript is the main programming language I’ve been using every day for many years. And I like it a lot.

One might say: “It looks like JavaScript is the best programming language to learn right now. Why then are you discouraging me from learning it, even if you yourself use it and like it?”

The problem with JavaScript is that it’s not the best programming language to learn as the first programming language. I’d even dare to say that it’s one of the worst programming languages to start learning programming with.

The ugly duckling

JavaScript has got the complicated history. Not that long ago it was the ugly duckling among all the programming languages. Nobody wanted to learn it and use it, because it had so many flaws in its design and you could do so little with it.

Now it’s almost turned into a beautiful swan, especially when it is used with TypeScript. But “under the hood” it still has its controversial parts stemming from its messy past.

If you’re a programmer who already knows any other popular programming language, you will understand these “particularities” of JavaScript pretty easily. They won’t completely confuse you, since you already have a reference point for what a typical programming language looks like.

But if you have no clue what’s not quite typical in some parts of JavaScript, because you simply don’t know what it would look like in other languages, then you will likely decide that that is how every programming language is designed.

Some parts of JavaScript will look weird and be difficult to understand, but you won’t even know that it is so only because the design of JavaScript is far from perfect.

As a result, it might distort your understanding of several basic principles most programming languages rely on. Eventually, it will hamper your learning of other programming languages.

Several versions of JavaScript

Since today JavaScript is only turning into a beautiful swan and is not there yet, there are several different versions of this programming language.

The old version have all of those “ugly” parts, the new one doesn’t have most of them (or, at least, you needn’t look at them anymore if you don’t want to). But you still have to understand and be able to use both versions.

Not everyone already uses the newest edition of JavaScript. Also, there are millions of lines of code written in the old version of JavaScript. You will inevitably have to deal with them if you want to use JavaScript to create real-world projects in the foreseeable future.

So, basically, you have to learn two versions of JavaScript, one of which is definitely not the best choice as the first programming language.

It would also be good to additionally learn TypeScript, which is kind of a third version of JavaScript (well, not quite, but let’s put it this way, in order to not make things sound even more complicated). You will likely be expected to know TypeScript if you plan on working on big enterprise-level web projects as a JavaScript developer.

Endless ocean of JavaScript libraries and frameworks

Even when you’ve successfully learned all versions of JavaScript, it’s not enough — you also have to learn additional tools to use this language effectively and efficiently.

No one uses “bare” or so called “vanilla” JavaScript to create big applications — everyone uses JavaScript frameworks and libraries, like React, which make your life as a JavaScript developer much easier.

The problem is there’s no definite set of such frameworks and libraries you should learn. There are hundreds (if not thousands) of them, and the new ones emerge every month. Each of them has its advantages and disadvantages, and there’s no way of choosing the best one. Your decision will always be imperfect to some extent.

Such a situation is quite uncomfortable even for experienced programmers, and it’s utterly confusing for beginners.

Learn JavaScript as your second programming language

JavaScript is the best programming language to learn second, and you should definitely do it.

But before learning JavaScript, learn some other popular language. For example, you can learn Python or C.

By many programmers Python is considered to be the best programming language to learn first. This is a powerful and extremely popular language, so to learn it is a great idea anyway.

As for C, if you’re planning on learning JavaScript afterwards, knowing C, you’ll discover that these two languages look very similar.

That’s because JavaScript’s syntax is based on the syntax of the C programming language (on the other hand, Python looks pretty different from both C and JavaScript). So, if you know C, it will be much easier to learn JavaScript, since while learning JavaScript you’ll meet a lot of “old friends” from C. The same, and even to a higher degree, stands for C and PHP.

Also, due to the rigorousness of C, learning this language is a good school to graduate from before starting learning JavaScript. It will teach you how to write lean, efficient, tidy code, with full understanding of and control over what’s going on when it runs.

It will balance the lack of strictness of JavaScript, which usually turns out to be pretty harmful to the quality of code and coding habits of those who chose JavaScript as their first programming language. This is another one big reason not to start learning programming with JavaScript.