Programming With Jon Logo

Programming with Jon

Vanilla JavaScript

February 24th, 2020

[object Object]

Hello, In this post I just want to talk about what I view Vanilla JS is. I was told by some pretty respectable front end engineers that the meaning of Vanilla JS was writing JavaScript without a framework. I believe this to be the correct definition of the term. Most times when you think of vanilla flavored items you think, "Oh that's the plain flavor", or "That is boring." Well I feel the same about JavaScript. Nowadays there isn't a way to throw a rock and not hit at least 4 different frameworks that are all JavaScript related and are all supposed to benefit the developer in some way or form. I am not saying not to use a framework. Quite the contrary. I love using frameworks. They do indeed speed up development. But if you are struggling to understand why a certain concept doesn't work in XYZ framework then you should strip away what you are trying to write in that framework. Break the problem down and write it out using just plain ole JavaScript. From time to time I struggle with why something works with let's say React or why something doesn't work. When I remove React from the equation and try to solve it using vanilla JavaScript I see where I was going wrong. Now granted you can write just plain JavaScript in React and a lot of other frameworks but if you see that you are getting errors when using your framework of choice I suggest ripping that code out. Creating a basic web page with nothing more than some HTML, CSS and JS and see if you are getting the output you were expecting. If it works then you might have to figure out how to modify it to fit in with the framework you are using. Maybe it's expecting a different syntax of some sort. If it doesn't work then I would suggest that you are doing something incorrect and you need to spend some time on learning the basics of JavaScript. I am not in any way shape or form saying you are not a good developer. Please don't think that. I am only saying this because I have been there. As a matter of fact I am currently working on a set of Vanilla JavaScript projects to reacquaint myself with the basics of the language. The projects that I am working on are part of a Udemy course from Traversy Media that you can take a look at here: 20 Web Projects You can check out my vanilla javascript projects progress over here: GitHub Now back to what I was writing about. There has been talks that Vanilla JavaScript is actually JavaScript pre ES6(ES2015), which I think is wrong. ES6 JavaScript can still be written without the use of a framework. ES6 JavaScript still works in a browser just like it would if you were using it with Angular or React. Yes it needs to be transpiled to ES5 in order for some browsers to render the JavaScript but I would not say that Vanilla JavaScript is JavaScript before ES6. What are your thoughts about what constitutes the definition of Vanilla JavaScript? Do you think that it is any JavaScript code written without a framework like React or Vue? Or would you say that it is any JavaScript before ES6?

Created by Jonathan Reeves, © 2020