Question: For the following piece of code

```
a.b = function c(){
    return function e(){
        return this;
    };
};
d = a.b();

```

What will the value of d() be? This might not be a very good example, but I am just confused about what "this" will refer to.

Thanks,

Answer: 
Seeing as d will now equal a FUNCTION, "this" will be evaluated to whatever function calls it. It hasn't actually been evaluated yet.

At the end of execution, `d='function e() { return this; }'`, so the moment you execute `d()` is when `this` will be evaluated.
Assuming `d()` was called immediately after the last line of your snippet `d()` will return the global object: `window` if you're in a browser.

However both of these are true:

```
d.call(a) === a;
d.call(a.b.prototype) === a.b.prototype;

```

which is to say that `this` is defined by what is passed in as the first argument to `call`.