Question: This is probably a basic question, and I am aware that there have been some similar questions around here, but still I did not find an answer. Please consider the following code:

```
function Outer(inner2) {
  var x = 5;
  this.inner1 = function() {return (x);}
  this.inner2 = inner2.bind(this);
}
var outer = new Outer(function() {return (x);});
alert(outer.inner1()); // works
alert(outer.inner2()); // does not work

```

If I would replace the second line by `this.x = 5;`, the second alert would work. So I guess the problem is that `x` when declared with `var` is not part of `this`, so that `bind` will have no effect.

Is there any way to make this work without using `this.x`?

Answer: 
I think you need clarification on what the word "this" is referring to.

"this" is *not* pointing to the function "Outer." 

When you invoke a constructor function with the "new" keyword, a few things happen.

1. The constructor function returns an object.
2. The "this" variable is changed, so that it is set to point to that object that is returned.
3. (Also, the .*proto* of the object returned is set to the .prototype of the constructor function, but that step is not relevant here).

So, you are binding the callback function **to the object that you are returning** from the constructor function, **not** the constructor function itself.

Thus, the callback function is bound to outer (with a lower-case), not outer (with an upper-case).

Also, when you bind, you are not binding to the *scope* of a function. X is not assigned to any property. I think you only can bind to an object and access its properties with this.a etc.

The x in the first function worked because its value was assigned in the scope of the function.
I found an, albeit ugly, solution:

```
function Outer(inner2) {
  var x = 5;
  this.inner1 = function() {return (x);}
  eval('this.inner2 = ' + inner2.toString());
}

```

This works and shows my point: the parameter `inner2` is just a prescription of how `this.inner2` should look like; it is never invoked itself.

Let me know, if you have a neater solution than this.