This is actually one of the best aspects of JavaScript.
Let's say you keep all those user-generated objects into a generic list, for example:
objList = {};
objList.coffee = new object("stuff", "input");
Interestingly, now you can read coffee
in two ways: by using objList.coffee
and by using objList['coffee']
. The same is true for writing; so we can rewrite the example as:
objList = {};
objList['coffee'] = new object("stuff", "input");
And voilà! You are now basically using strings to identify variables. Well, sort of - they're not variables anymore, they're properties on a JS object. But still.