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.
What your code produces is:

```
0 = 0 + <some number>

```

Which variable do you want to update? `cL`? You are declaring it in the function, you cannot assign a value to it from outside. Depending on the rest of your code, you might be better off with [`getters and setters`](https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Working_with_Objects#Defining_Getters_and_Setters):

```
var object = {
    _cL = 0,
    get currentLocation() {
        return this._cL;
    },
    set currentLocation(value) {
        this._cL = value;
    }
}

```

then you can do:

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

```

**Update:**

Regarding IE: If `currentLocation` should actually be just a number, it might be sufficient to just declare it as property:

```
var obj = {
    currentLocation: 0
}

```