What is the proper way to acces a property from an object inside several scopes of a method?
<p>For example, if I have the object:</p>

<pre><code>function Website(){
    this.images = [];
}

Website.prototype.getImages = function(){
    jQuery('img').each(function(key, val){
        this.images.push(val.src);
    })
}
</code></pre>

<p>and I try to call <code>website.getImages()</code> I get this error: <code>TypeError: Cannot call method 'push' of undefined</code></p>

<p>So, in order to fix this, I would do:</p>

<pre><code>Website.prototype.getImages = function(){
    var images = this.images;
    jQuery('img').each(function(key, val){
        images.push(val.src);
    })
}
</code></pre>

<p>But I don't see this solution as clean, because what if im trying to access several variables.</p>

<p>Is there a cleaner and better way to do this?</p>
