functions nested under a prototype function behave differently
<p>Functions nested under a prototype function do not get the this.variables defined for the prototype.</p>

<pre><code>var Person, p;

Person = function(name, age) {
  this.name = name;
  this.age = age;
};

Person.prototype.getInfo = function() {
  var innerFun;
  innerFun = function() {
    return this.name;
  };
  return "name: " + (innerFun()) + " age: " + this.age;
};

p = new Person('dork', 99);

console.log(p.getInfo());      // name:  age: 99
</code></pre>

<p>I thought that since every function is an object, <strong>this</strong> would be different within every function definition; but the following code blows away that logic.</p>

<pre><code>var getInfo;

getInfo = function() {
  var display;
  this.name = 'dork';
  return display = function() {
    return this.name;
  };
};

console.log(getInfo()());     // dork
</code></pre>

<p>Is there a logic behind this behaviour or should I just take it as a rule and use call() to get around this problem?</p>
