let a = {key: 'a'};
function foo( a ) {
a = {otherKey: 'b'};
}
foo( a );
console.log( a ); // {key: 'a'} let a = {key: 'a'};
function foo( a ) {
a['otherKey'] = 'b';
}
foo( a );
console.log( a ); // {key: 'a',otherKey: 'b'}