O'Reilly logo
  • Ivan Petrov thinks this is interesting:

// Create a closure
var SecretStore = (function() {
  var data, secret, newSecret;
 
  // Emulation of a private variables and functions
  data = 'secret';
  secret = function() {
    return data;
  }
  newSecret = function(newValue) {
    data = newValue;
    

From

Cover of Expert JavaScript

Note

Singleton module pattern