Utilizing JavaScript Closures

Jacob Lozano
2 min readDec 22, 2020

JavaScript closures allow JS to emulate object-oriented languages without the use of frameworks or packages. Closures aren’t exactly intuitive, but what they lack in readability, they make up for in functionality, for lack of a better term.

To start off with, closures are formed by functions. A closure is defined by MDN as

the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function.

--

--