What is the simplest/cleanest way to implement singleton pattern in JavaScript?
Not sure why nobody brought this up, but you could just do:
var singleton = new (function() { var bar = 123 this.foo = function() { // whatever } })()