
Protecting objects in JavaScript - austengary
http://www.2ality.com/2013/08/protecting-objects.html
======
IgorPartola
Here's another cool trick for making attributes of an object private:

    
    
      function MyObj() {
        var data = {
                id: 123,
                name: "Johnny Appleseed"
            },
            obj = {};
    
        obj.printName = function() {
            console.log(data.name);
        };
    
        obj.changeName = function(name) {
            data.name = name;
        };
    
        return obj;
      }
      
      x = MyObj();
      
      x.printName();
      x.changeName("Igor");
      x.printName();

