Why learn vanilla JavaScript first?
When deciding whether or not to learn this language, what you’re really asking is whether or not you should learn “vanilla” JavaScript. Vanilla JavaScript just means the basic language without any libraries or frameworks. Let’s explore what this means in more detail now.
What is meant by vanilla JavaScript, libraries, and frameworks?
If you research the term “vanilla JavaScript”, you might run into some confusion; however, all you need to know is that vanilla JavaScript is used to refer to the native, standards-based, non-extended version. There is no difference between vanilla JavaScript and JavaScript—it’s just there to emphasize the usage of plain JavaScript without the use of libraries and frameworks.
So what are libraries and frameworks?
JavaScript libraries and frameworks both contain sets of prewritten, ready-to-use code—but they’re not the same thing. You can think of a framework as your blueprint for building a website: it gives you a structure to work from and contains ready-made components and tools that help you to build certain elements much quicker than if you were to code them from scratch. Some popular JavaScript frameworks include Angular, Ember, and Vue.
Frameworks also contain libraries. Libraries are smaller than frameworks and tend to be used for more specific cases. A JavaScript library contains sets of code that can be called upon to implement certain functions and features. Let’s imagine you want to code a particular element into your website. You could write, say, ten lines of JavaScript from scratch—or you could take the condensed, ready-made version from your chosen library. Some examples of JavaScript libraries include jQuery, Lodash, and Underscore.
The easiest way to understand how frameworks and libraries work together is to imagine you are building a house. The framework provides the foundation and the structure, while the library enables you to add in ready-made components (like furniture) rather than building your own from scratch.
You can learn more about the relationship between languages and libraries in this post explaining the main differences between JavaScript and jQuery. For now, let’s go back to our original question: How important is it to learn vanilla JavaScript?
Should you learn vanilla JavaScript first?
When it comes to learning the language, it can be tempting to skip ahead to those time-saving frameworks and libraries we just talked about—and many developers do. However, there are many compelling arguments for learning plain JavaScript first.
While JavaScript frameworks may help you get the job done quicker, there’s only so far you can go if you don’t understand the core concepts behind these frameworks. Frontend developer Abhishek Nagekar describes how not learning vanilla JavaScript came back to bite him when he started learning the JavaScript frameworks Node and Express:
“As I went to write more and more code in Node and Express, I began to get stuck at even the tiniest problems. Suddenly, I was surrounded with words like callbacks, closures, event loop and prototype. It felt like I got a reintroduction to JavaScript, but this time, it was not a toddler playing in its cradle, it was something of a mysterious monster, challenging me on every other step for not having taken it seriously.”
If you want to become a developer who can innovate, not just execute, you need to understand the underlying principles of the web—not just the shortcuts. This means learning vanilla JavaScript before you move on to frameworks. In fact, understanding plain JavaScript will help you later on when it comes to deciding whether to use a framework for a certain project, and if so, which framework to use.
Ultimately, if you want to work as a web developer, it’s inevitable that you’ll encounter this web development language at almost every turn. Learning plain JavaScript first will make you a versatile engineer who can work on both the frontend and the backend, and it’ll equip you to solve complex problems independently—a key skill in the industry.
Comments
Post a Comment