Writing code that works is good; writing code that is readable and reliable is better. A handful of habits make all the difference.
Habits worth adopting
- Choose clear names for your variables and functions (
totalrather thanx). - Reach for
constby default andletonly when you need it. - Comment the tricky parts so you can pick the code up again easily.
- Split your code into short functions, each with one clear job.
- Test regularly in the console and fix errors as you go.
Keep making progress
JavaScript is a vast language. Once you have these foundations, you can explore arrow functions, frameworks such as React, or more advanced asynchronous programming. The most important thing: practise regularly on small, concrete projects.
Well done: you now have solid JavaScript foundations. Clear, tested, well-structured code: you are ready to build your own projects!