🚀 New & Updated! The Vanilla JS Pocket Guides have been completely updated with new methods and modern JS approaches.
- 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.
- 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.