When developing software, at its basic level, you have three responsibilities that need to be managed.
- Input: consist of user actions.
- Output: change to the web browser.
- Logic: any piece of code where a decision is made.
To manage this complexity, you should be Unit Testing if not testing-first.