var collection = ( function ( ) { // private members var objects = []; // public members return { addObject : function ( object ) { objects.push(object); }, removeObject : function ( object ) { var index = objects.indexOf(object); if (index >= 0 ) { objects.splice(index, 1 ); } }, getObjects : function ( ) { return JSON .parse( JSON .stringify(objects)); } }; })(); collection.addObject( "Bob" ); collection.addObject( "Alice" ); collection.addObject( "Franck" ); // prints ["Bob", "Alice", "Franck"] console .log(collection.getObjects()); collection.removeObject( "Alice" ); // prints ["Bob", "Franck"] console .log(collection.getObjects()); var namesCollection = ( function ( ) { // private members var objects = []; function add...