Javascript difference between functions within an object
<p>What is the difference between functions within an object. I have 2 examples which basically do the same thing.</p>

<pre><code>function a(param) {
   function b(input) {
      return input%10;
   };
return 'The result is ' + b(param);
};
</code></pre>

<p>and</p>

<pre><code>function a(param) {
   this.b=function(input) {
      return input%10;
   };
return 'The result is ' + this.b(param);
};
</code></pre>

<p>What is the advantage and the disadvatages in both cases? In the second i know that that function can be called from outside the main function.
Is there also a difference when running it? (like time and performance)</p>
