Even then... most modern JS is written in modules (cjs or esm)...
//module singleton...
let numProcess = 0;
export default { // or module.exports for cjs
increment: () => numProcess++,
};
Can still have the internal numProcess private.
This is a very good addition recognising the implicit module environment we're all most probably working in (leveraging tools like Webpack, etc.), thank you for sharing this!