Understand module pattern and singleton pattern in JavaScript | Dark Hacker News