function – Simplest/cleanest way to implement a singleton in JavaScript



function – Simplest/cleanest way to implement a singleton in JavaScript

function - Simplest/cleanest way to implement a singleton in JavaScript

#short
#javascript
#function
#design-patterns
#singleton
What is the simplest/cleanest way to implement the singleton pattern in JavaScript?
module pattern: http://www.yuiblog.com/blog/2007/06/12/module-pattern/
closures: http://www.jibbering.com/faq/faq_notes/closures.html
Object.freeze: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze