I'm running into an issue where a variable assigned to the property of a global object does not get updated. I know this is some kind of javascript pass by reference issue that i'm not understanding, despite having looked through some other similar SO questions. Here's the some code I wrote to test this scenario:

```
function formState (type) {
    this.current_form = { primary:null};

    this.set_primary = function(form) {
        this.current_form.primary = form;
        return this.current_form.primary;
    };

}

var schedule = function(someState) {
    someState.set_primary({"updated":"updated"});
};

var state = new formState();
var newState = state.set_primary({"new":"new"});
console.log("newState = ", newState);
schedule(state);
console.log("newState = ", newState);

```

A `console.log` at the end shows that `newState = { new: 'new' }`. Why is this? If `newState`is referencing a block of memory, shouldn't I be able to update that memory from anywhere and have the changes be reflected in `newState`? I'm missing something fundamental here, any help would be appreciated.

Here's the corresponding [repl](http://repl.it/Tjx/3).