Vanilla Js or Plain Js or Javascript in Browser

Why do we need to know pureJs when we have libraries & frameworks?

What is Vanilla Js?

what is vanilla js.jpg

The term vanilla script is used to refer to the pure JavaScript (or we can say plain JavaScript) without any type of additional library like React and jQuery.

I learnt Javascript using a library called Reactjs and I would say its totally fine to learn a library now a days, you can get all your work done but knowing pure Javascript has its own benefits and you feel like much closer to the language .

Why you should learn Vanilla Javascript?

We might get a thought that why learn vanilla JavaScript when you’ve got Angular, React and Node.js? Well, there are several reasons for choosing the vanilla js to learn and use it in our projects, I'll go with mentioning some points :

logo_640.png

Better Understanding

Learning Vanilla Js is like building a house from scratch and not renting a house. You know everything about your house but in a rented house you just satisfy your requirements of having an accommodation.

Something similar happens with the frameworks and libraries, we can really get our task done in a very quick and efficient way but whenever we need to implement a feature our ability to create custom configurations is limited to what’s available in our chosen framework or library. So, that's why learning pure Js helps us in better understanding of the Javascript and we can implement whatever we are thinking in our heads, even we can build our own libraries.

Makes it easy to work with frameworks and libraries

download (1).png

When you learn pure JavaScript, your ability to adopt new frameworks and libraries increases. This is because now you’re able to look at a piece of code and understand what it means and what task does it perform. When you know Javascript you know what your block of code is doing and you are not just including it because it somehow's satisfying your current need.

There was a very nice comparison I have seen on the internet it was like, the difference between those who know and understand JavaScript and those who don’t is the difference between being a mechanic and being a driver. If your car breaks down, the mechanic would have a higher chance of fixing the car than the driver on their own.

Performance

This is much better for web performance than many other frameworks and libraries, as it is the most expensive and important part of the front-end stack. Vanilla js code needs to be compiled and parsed, unlike HTML and CSS files, which are available to use only when they're downloaded. A file of js with a size of 50kb has a much more significant impact on web performance than the same size of HTML and CSS files.

It provides an effortless but user-friendly developing experience. While developing an application or website using JavaScript, a developer just needs to open the text editor and can begin coding. There is no need for the developer to perform troublesome steps like npm install, compilation steps, and no build, etc. Well, its not true always, because there will be many times in your development journey when you need to use someone else's code in your project because you can't write everything from scratch but having knowledge of pure Js always gives an upper edge.

No Comments Yet