It’s been a while since I started learning JavaScript and, like other languages I learn, I like to discover ways to code efficiently. In this article, I’m going to show you some of the most awesome libraries and VSCode extensions that will improve your JavaScript coding experience.
“The most damaging phrase in the language is ‘We’ve always done it this way’.” — Rear Admiral Grace Murray Hopper
Ramda
Ramda makes JavaScript too easy, you don’t really need to think about the logic behind your functions after you start using it. Did you build 3 functions and need to apply them to an array multiple times? Use applyEach( )! Or maybe you want to apply a function multiple times? Use applyN! It’s a neverending list, check out their Cookbook.
MathJS
Are you working on a project that needs more calculations than you can handle? MathJS is the library for you! From rounding numbers to chaining multiple mathematical operations, it can make your loops and conditionals look like useless expressions. With simple functions, your code will look more beautiful than never!
Sugar
Do you like working with native objects, such as Arrays? Well, then Sugar will help you work with them. You can get the first and last element from an Array, or even get the average of a number Array. By using simple functions, you can delete all of those multiple lines of code you currently have and do everything within one line!
Lazy
I don’t really need to tell if this is for you or not, right? If you are lazy, go ahead and install Lazy. Just think about the huge functions that are present in your code, do you like them? Of course not! With this library, you can create an infinite Fibonacci sequence with 8 lines of code, or maybe you want to generate 300 random numbers from 1to 1000 with 4 lines of code?
JavaScript (ES6) code snippets
Are you using pure ES6 Javascript? Oh, you are not sure because you are still learning? Worry not, this extension will help you do that easily! This extension works when building React and Vue apps too, and it’s very simple to use, it will just highlight and show you if you are doing it right or not.
Bracket Pair Colorizer 2
This extension is not only useful for JavaScript, but for any coding language. Are you tired of counting how many brackets you still need to close? Then go ahead and try this one out, it's just amazing! I believe I don’t need to explain how it works, its name already gives you a spoiler.
ESLint
I’m sure you are already using ESLint to improve your code, but are you still typing
npx eslint
. ? If you are, then stop it already and install this extension! It will simply tell you when you are making a mistake, based on the rules you implemented. This is awesome, because it allows you to actually learn about what you are doing wrong while you are doing it, and not only at the end.Quokka
Imagine a world where you call a function to sum to numbers and the result magically appears beside the function call. This extension does that exactly, it just shows you what will happen when you run your code! Lose no more time debugging something you implemented ages ago!
CodeMetrics
Are you worried that your code is too complex but you leave refactoring for later? This extension just won’t let you get away so easily, it will show you the complexity of your functions after you finish typing them! Also, they will leave a very ‘nice’ message for you when giving you feedback.
As I always say in my articles:
“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live” — John F. Woods
You won’t become a super code writer after using these packages and extensions, but they will help you enough. Not only that, but these resources will also teach you how to write better code, especially the ESLint one.
If you liked this article, make sure to: