In general, it is better to avoid functions that have side effects, for example. change their arguments. If your function needs to create something, just return this "something":
// good way function mkArray(xml, tag) { var store = []; // populate store... return store; } myStore = mkArray(xml, tag);
If for some reason this does not work for you, you can also change the function argument, but the object itself must be created in the calling code:
georg source share