From the course: Visual Studio Code Productivity Tips

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Refactor the code

Refactor the code

- [Instructor] Writing code is a constant exercise in developing your skills. First, you write and test code to ensure that it works, and then as the project progresses, you find ways to improve and change the code. This process, known as refactoring, involves restructuring your code without modifying its runtime behavior. Refactoring enhances the quality and maintainability of your project. I'm looking at my code here in this RefactorHere.js file and I see some improvements that I can make. One of the first changes is to refactor this variable shown on line eight. Currently it's named ar, which isn't very descriptive. While JavaScript developers favor short names, I can enhance clarity by adding just a few characters to make the variable name more descriptive. Some of the other refactors I'll do in this one is I'll take this literal value, this magic number, and I'll extract it into a constant. And then, you'll notice that I have this expression here that's repeated in two places…

Contents