Skip to main content Accessibility Feedback

Boilerplates

A set of templates to help you kick-start your next JavaScript project.

🚀 Learn how to write more flexible, resilient JavaScript with my Vanilla JS Pocket Guides and Videos.
  • IIFE. Used when you want your code to run immediately, but want to keep all of your variables and functions out of the global scope to avoiding conflicts. Stands for Immediately Invoked Function Expression.
  • Revealing Module Pattern. Allows you to keep most of your variables and functions out of the global scope, but make some of them publicly available. Example: a helper library like lodash.
  • Constructor Pattern. Create multiple instances of script that share methods but contain unique information. Example: a DOM manipulation library like jQuery.
  • Revealing Constructor Pattern. Create multiple instances of script with public and private methods. Example: a plugin.
  • UMD. Provides support for JavaScript module bundlers and loaders, as well as global namespacing (like with the other patterns).
  • Settings and Options. Let users pass in options to customize the script. Works with any of the patterns.
  • Performance Test. Write simple vanilla JS performance tests.