access outer "this" in Javascript sort method
<p>I have this code:</p>

<pre><code>function some_object(...) {
   this.data = {...};

   this.do_something = function(...) {
      var arr = [...];

      arr.sort(function (a, b) {
         return this.data[a] - this.data[b];
      });  
   }
}
</code></pre>

<p>However it's not working I think because <code>this</code> cannot be accessed in <code>sort</code> - another <code>this</code> is seen there for some reason, not the <code>this</code> of enclosing outer object.</p>

<p>What to do? thanks</p>
