Skip to main content
Practice Problems

What is Module design pattern?

javascript
const Counter = (function() { // Private let count = 0; // Public API return { increment() { count++; }, getCount() { return count; } }; })(); Counter.increment(); console.log(Counter.getCount()); // 1 console.log(Counter.count); // undefined - private!

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

Finished reading?
Practice Problems