/** * Implement Foo Object. * - Take a JSON object as an input parameter * - Create a copy this JSON object as itself. * - Chainable */ var foo = new Foo({ version : '1.0' }); // add components foo .set({ type : 'Foo', container : '#foo' }) // add features .addItem(['item1','item3']) .addItem('item2'); /** * Expect output */ foo = { version : '1.0', type : 'Foo', container : '#foo', items : ['item1', 'item3', 'item2'] }