From the course: Visual Studio Code Productivity Tips

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Refactor the code

Refactor the code - Visual Studio Code Tutorial

From the course: Visual Studio Code Productivity Tips

Start my 1-month free trial

Refactor the code

- [Instructor] I'm looking at my code in this RefactorHere.js file, and I think there's some improvements I can make. I can refactor this code to make it better. The first thing I want to edit is this variable name on line 11, it's called ar. And that's not very descriptive of what this variable does. In JavaScript, we like short names. But I can improve this by only adding a couple of extra characters. You know that writing code is a constant push and pull on your development skills. You write some code and you test and make sure it does what you think it will do. That it works the way you intended. And then, as you learn new techniques, or as the project progresses, you discover ways to improve and change the code. So that's what we're doing here. The first attempt at naming this. Just renaming it area, that's a better name. It only changes one line. It doesn't change line 12 and line 14. So I can fix that. Go back to the old variable name. And then right click and choose Rename…

Contents