Coding Newbie

vanilla javascript

What is Vanilla JavaScript and should you learn it first

Learning JavaScript can be an overwhelming and difficult task, especially when we take into consideration how many different JS frameworks and libraries exist. We have jQuery, Angular, Vue, React, Next.js, Node.js, etc. And there is Vanilla JavaScript.

So, what exactly is Vanilla JS, and should we learn it first? Where should you start?

If you are unsure what JavaScript is and you are interested to read more about it first, you definitely should read an article What Is JavaScript? Complete Beginners Guide.

What is Vanilla JavaScript?

We use the term Vanilla JavaScript to describe pure, plain JavaScript. It is JavaScript without any type of additional libraries.

The reason behind developing JavaScript libraries lies in the fact that these libraries helped overcome the limitations of pure JavaScript at a time. In addition, these libraries often were more user-friendly than plain JavaScript. This is something that ECMAScript specifications (basically JavaScript standards) solved and provided much needed consistency across the browsers.

Who uses Vanilla JavaScript today?

Although JavaScript libraries are quite popular today and in demand, in fact Vanilla JavaScript is in use at global companies. Some of those companies are Facebook, Google, Wikipedia, Youtube, Amazon, Twitter, Microsoft, Apple, PayPal, and much, much more.

Not only this, but Vanilla JS is present on more websites than the number of websites of several JS libraries combined!

This is because pure, Vanilla JavaScript code, is much lighter when it comes to processing. For example, retrieving the element by its ID is around 35 times faster if you use Vanilla JS instead of jQuery!

With that being said, should you actually learn Vanilla JS first? Especially if you consider that there are many powerful libraries available, which can be easier to cope with? Let’s take a closer look.

It is a much simpler task to start coding.

With JS libraries, you have to download and install the desired framework. With Vanilla JavaScript, all you need is a text editor. As a developer, you can edit your code anywhere and at any time.

You get a much greater understanding of JavaScript language.

woman, computer, desk-5474990.jpg

Learning Vanilla JS is actually learning what happens under the hood. With going straight to JavaScript libraries, many developers skip to learn some core JavaScript concepts. This in fact, can make understanding the library itself a more difficult task.

Knowing pure, plain JavaScript, gives you the power to understand what is happening behind the scenes, which helps you acquire better comprehension of JS language.

With overcoming pure JavaScript, you can much easier learn JS frameworks.

As these libraries are in fact tools using JavaScript, if you know how the language itself works, you will be able to learn any JS framework not only faster, but also with deeper understanding.

If you know Vanilla JavaScript, you are not dependent on the frameworks.

Libraries are constantly changing, evolving, some of them are getting obsolete with time. However, if you know the language itself, you are not tied down to libraries learned.

In addition, you avoid limitations of chosen framework. With Vanilla JS you can create customized code, without the restraints of specific libraries.

You will in fact write better code. Learning Vanilla JS will grant you deeper knowledge of the topic.

With knowing the essence of the language, you will be able to write simpler, and more effective code. This will reflect on your knowledge of JS libraries also, as you will start reducing the complexity of your code.

My own experience…

Not long ago, I made the mistake of learning jQuery first, without understanding at least the basics of JavaScript. Why do I say it was a mistake?

Because I experienced the problems mentioned above. At first, it was a delight just how simple jQuery was in comparison to plain JavaScript. However, in the long term, that was not the case. When the code started to become more complex, I realized how little understanding of the language itself I possess. And that made it harder for me to continue with further learning. In addition, jQuery was losing popularity, as it had its limitations.

After a while, I decided to start again, but this time, with Vanilla JS. I still learn it, and have a long road to go. But getting a grasp over the language itself, the mechanism behind the scenes, helped me to stay on track and try some more complex projects.

In my own opinion, I believe it was the right thing to do. Especially if we take into consideration that many things that were not possible before, are in fact feasible today in Vanilla JS. Not only that, but now I feel more comfortable with starting to learn additional libraries and frameworks.

Conclusion

In the long term, learning Vanilla JavaScript will definitely pay off.

Knowing Vanilla JS will make you more flexible in the world of ever changing and emerging libraries and frameworks. And limiting your knowledge toward one framework, without understanding the language itself, will make learning a new library a more difficult task.

Libraries come and go, but plain, Vanilla JavaScript is the language of web browsers.

%d bloggers like this: