Member-only story
I Rewrote My JavaScript Code Using These 10 Techniques
Once there was a time when my JavaScript code worked.
This was the trouble.
It worked but it became more and more difficult to read, change and debug.
What began as a function with 10 lines grew to be one with 50.
The seemingly harmless if condition became an intricate series of nested conditions.
The API call became one with multiple levels of try-catch blocks.
Along the way, it got to the point where I found myself writing code which solved today’s problems but created tomorrow’s.
Thus, I did what was simple:
I stopped adding any more features and instead began refactoring my own code.
I did not bring a new framework into play.
I did not add yet another library to the project.
I did not rewrite everything in TypeScript.
Instead, I concentrated on some techniques from plain old JavaScript which helped make my code better.
Here are 10 such techniques.









