See the following example:
var foo = { bar : 0 };
function modify(obj)
{
obj = {};
}
modify(foo);
console.log(foo);
My first object in the global scope remains unchanged. Because the function did not replace the object but a copy of the reference.
So my question is simple. Does anyone know of a work-around way, or are there ECMAScript features in currently development or have there been attempts to make this possible at all?
Thanks.