In JavaScript I want to create a collection in following way -
Start with an empty collection with var c = [];
Then I want to add item in it; after addition it will look like
{ 'buttonSubmit': function() { /* do some work */ } },
{ 'buttonCancel': function() { /* do some work */ } }
I must add item one by one using loop and records are not json string. I know the push method but problem is it creates indexed array which I don't want to use because I want to retrieve the value from the collection using c['buttonSubmit'] or d.buttonSubmit. I want to avoid looping and compare key name.
Please help me with some simple code example.