Why is important to learn Vanilla JavaScript first before opting for a framework or library?
Tags: javascript, framework, library
Published: 2018-03-07 21:46:34

---
title: Why is important to learn Vanilla JavaScript first before opting for a framework or library?
published: true
description: Why to learn Vanilla JavaScript first
tags: javascript, framework, library
---

JavaScript, a popular word mentioned in recent days, isn't it?. Its valid to say that is one of the most important programming languages of these days. We can develop almost everything with this language from native mobile applications to complex applications on the server with excellent performance results. It has more than 20 libraries and frameworks developed and maintained by reputable companies like Google and Facebook.

Framework? library? Ups!! Here comes the first unknown words. If we consult Wikipedia we can see that a **framework** *is a standardized set of concepts, practices and criteria to focus on a particular type of problem that serves as a reference, to confront and solve new problems of a similar nature set*. We also find that a **library** *is a set of functional implementations, coded in a programming language that provides a well-defined interface to the functionality that is invoked*. A little confusing right? Let's clarify this. A framework is a set of tools, libraries and best practices to solve certain problems. An example of this is Angular, which aims to facilitate our SPA web application development, and also provide us with a number of tools to work with the elements of a web in a simpler and optimally way. While the goal of the library is abstracting a series of more or less complex operations in a simple API, comfortable and easy to invoke functions. For example, the jQuery library allows complex and varied operations such as manipulating the DOM, manage events, create animations, etc,. And get it done through a clear, concise API and also supports multiple browsers.

"**Should I learn React, Vue or Angular?**", "**I learn jQuery to the max!**", "**jQuery is old, I learn Ember**", these are some of the questions or trivial claims that many people make when they decide to learn JavaScript. **STOP DOING THIS!✋🏼.** It is a serious error. It is impossible to make pasta without having boiled spaghetti or prepared sauce, like it is impossible to master a framework or a library without having delved into Vanilla JS.

The problem with frameworks and libraries, basically is the weight. For example, the weigth of jQuery is 250kb (90kb if minified). At first it doesn't seem like a problem, but it does if you have 60,000 visitors a month on your website. jQuery consumes 4gb of traffic. Not bad, but believe it or not, jQuery and other JavaScript libraries weigh a lot. When you realize the impact it can have the use of a library on your system it is time to consider whether you really need it or not. Was I getting overloaded for "Three nonsense"?. I can answer that. On many occasions I did. I always used jQuery or Vue on all my projects, just to select a DOM element and change the text <code>$(".element").text("hello world";)</code> or to make AJAX requests <code>$.ajax({url: "http://mypage.com/api/user"}, method: "POST", data: {}, success: () => { // do something } })</code>(a classic). But, for this simple cases and others a little more complex this is no longer necessary.

##The solution here is clear and precise: **Vanilla JavaScript**

Since 2015 JavaScript has evolved and has become a very robust and complete programming language. Many features that we needed to use a library are already built natively. Native JavaScript functions are very powerful, and running at a lower level than that of JavaScript and that provides greater speed when analyzing the nodes of a web, and select them in the right way. My advice is to understand that you can do everything without the typical frameworks and libraries. We should think more about the efficiency of a web. When you learn vanilla javascript you will have more power, you will understand any framework without problem and above all, you will be a complete developer. My friends always ask me about a good book to learn javascript and my answer is always the same:

1. [Eloquent JavaScript by Marijn Haverbeke](http://eloquentjavascript.net/)
2. [You Don't Know JS Book Series (6 Books) by Kyle Simpson](https://github.com/getify/You-Dont-Know-JS)