Why can't I assign a new value to "this" in a prototype function?
<p>Why can I do this:</p>

<pre><code>Array.prototype.foo = function() {
    this.splice(0, this.length);
    return this.concat([1,2,3]);
}
</code></pre>

<p>But I can't do this:</p>

<pre><code>Array.prototype.foo = function() {
    return this = [1,2,3];
}
</code></pre>

<p>Both functions destroy the value of this and change it to <code>[1,2,3]</code> but the second one throws the following error: <code>Uncaught ReferenceError: Invalid left-hand side in assignment</code></p>

<p>I suspect it's because allowing assignment means I could potentially change the array to something else (like a string), but I'm hoping someone out there knows for sure and/or has a more detailed explanation.</p>
