When I started getting more into JavaScript I was looking for the best ways to organize my code. One of the most popular is to use the Module Pattern. This pattern provides structure and helps you to write self-contained decoupled pieces of code. Here is an example template: