Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaScriptclosures as a patternSingle-choice MCQ

The module pattern uses a closure to create private state. After this IIFE runs, which statement is true about accessing `count`?

const counter = (function () { let count = 0; return { inc() { return ++count; }, get() { return count; }, }; })(); counter.inc(); counter.inc();