Question: Hi guys I am writing some code using the object literal pattern, I have function that returns a value:

```
'currentLocation': function() {
    var cL = 0;
    return cL;
    },

```

I then need to update the variable 'cL' from another function like this:

```
teamStatus.currentLocation() = teamStatus.currentLocation() + teamStatus.scrollDistance();

```

This part is part of another function - however I get an error back stating: invalid assignment left-hand side

I am guessing I can not update the variable in this way, could anyone suggest a better method or point me in the right direction.

Any help would be greatly appreciated.

Going to add more code to highlight what I am trying to do:

```
'currentLocation': function() {
    var cL = 0;
    return cL;
    },
'increaseTable': function() {
    if (teamStatus.currentLocation() <= teamStatus.teamStatusTableHeight() ) {
        teamStatus.currentLocation = teamStatus.currentLocation() + teamStatus.scrollDistance();
        $("#tableTrackActual").animate({scrollTop: (teamStatus.currentLocation)});
        $("#tableMembers").animate({scrollTop: (teamStatus.currentLocation) });
        //console.log(teamStatus.currentLocation());
        teamStatus.buttonRevealer();
    }
}

```

As you can see increaseTable should update the value of currentLocation - help this sheds more light on what I am trying to achieve.

Answer: 
You're writing `teamStatus.currentLocation() =`, which calls the function `teamStatus.currentLocation` and tries to assign to the return value. That isn't valid. You want just `teamStatus.currentLocation =` — no function call.
The variable inside your function is completely private to that function (and any functions defined within it). If you need to create a number of functions that share a set of private variables, you can do that with a closure. For instance:

```
var Thing = (function() {
    var thingWideData;

    function getData() {
        return thingWideData;
    }

    function setData(newData) {
        thingWideData = newData;
    }

    return {
        getData: getData,
        setData: setData
    };

})();

```

What that does is create a `Thing` object which has `getData` and `setData` functions available for it, which get and set the *completely private* `thingWideData` variable contained by the anonymous closure. More about this pattern [here](http://blog.niftysnippets.org/2010/03/anonymouses-anonymous.html) and [here](http://blog.niftysnippets.org/2009/09/private-methods-in-javascript.html), although the latter of those is more about private methods than private data.