Jump to ratings and reviews
Rate this book

Refactoring JavaScript: Turning Bad Code Into Good Code

Rate this book
If your JavaScript is a mess, frameworks can only do so much to help. No matter what framework, "compiles-to-JS" language, or library you use, bugs and performance concerns will always be an issue if the underlying quality of your JavaScript is poor. With this hands-on guide, youíll learn how test and refactor your existing code to help reduce complexity, improve readability, and gain confidence in the codebase.

Author Evan Burchard shows you how to identify areas of bad code, and then takes you through several refactoring methods for improving them. Techniques range from renaming variables to applying principles of functional and object-oriented programming. If youíre motivated to write better JavaScript code either on the frontend or backend, this book is a must.

Use refactoring to restructure existing code, without changing its behavior Learn the relationship between refactoring and quality Explore the many versions of JavaScript in use today Create automated tests to confirm that your code works, and find bugs that slip through Learn how to refactor simple JavaScript structures, functions, and objects Refactor your codebase by applying object-oriented and functional programming principles Examine methods for refactoring asynchronous JavaScript

444 pages, Paperback

24 people are currently reading
101 people want to read

About the author

Evan Burchard

3 books2 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
4 (12%)
4 stars
18 (56%)
3 stars
8 (25%)
2 stars
2 (6%)
1 star
0 (0%)
Displaying 1 - 4 of 4 reviews
Profile Image for Sina.
41 reviews8 followers
April 17, 2019
Good but not that good! It takes a few months for me to finish this. First six chapters were good both in terms of comprehensiveness and topics it has covered. However last chapters were too complicated to understand, for me at least.
I may get back to it later in the future.
Profile Image for BT.
95 reviews2 followers
July 30, 2025
Simplified material on testing, refactoring, design patterns, and functional programming to give the reader a basic overview of each and a taste of what they have to offer.

Has some misunderstandings about basic JavaScript, but nothing that prevents you from getting something from the material. Also, the Sanctuary JS material is already out of date, but that comes with the territory of using a library still in beta. Thankfully, it is easy enough to convert and gets you digging into their documentation.

Overall, a recommended read for people who believe that you can only solve problems in a certain subset of ways in JavaScript.
204 reviews
May 1, 2022
Using one example of poor code - a Naive Bayesian Classifier - and taking it through several styles of test-driven refactoring (procedural to OO to functional) this is an inspirational book for anyone working in a poorly served legacy code base. Change is possible!
Displaying 1 - 4 of 4 reviews

Can't find what you're looking for?

Get help and learn more about the design.