Clean Code Tips in Javascript/Typescript
6 min readJan 11, 2023
There are a lot of articles about the principle of clean code, but my questions are:
- Can you memorize all of them and do them in real work?
- Can you write clean code when you are a newby or a junior developer?
- Can you write clean code, when you are given a task you need to do immediately?
So In this article, I’m going to introduce practical tools for clean code and the most important principles of clean code that you should always follow even if you have little time to do your work or if you are newby.
Do the below tips every time:
In the below repository of Github, you can see all of the principles of clean code, but memorizing and using of all them is not easy.
In this repository of GitHub: https://github.com/ryanmcdermott/clean-code-javascript
Make sure variable names are meaningful and pronounceable
// Bad:
const yyyymmdstr = moment().format("YYYY/MM/DD");
// Good:
const currentDate = moment().format("YYYY/MM/DD");