Cant understand what this refers to
<p>Can anybody elaborate below in <code>innerF</code>, what does <code>this</code> refer to? <code>User</code> or <code>innerF</code>?</p>

<pre><code>function User(){
  this.id = 1;
};

User.prototype.sayHi = function(){
    var innerF = function(){
        this.id = 2; // "this" refers to User or innerF ?
    };

    return innerF;
};
</code></pre>

<p>Also does the <code>new</code> keyword or <em>anonymous</em> function has to do with changing reference of <code>this</code> keyword?</p>

<p>What if I call it all like this:</p>

<pre><code>var u = User;
var f = u.sayHi();
f();
</code></pre>

<p>Or</p>

<pre><code>var u = new User;
var f = u.sayHi();
f();
</code></pre>

<p>Thanks</p>
