Accessing Data from JavaScript Object's Array Member Variable
<p>I'm writing a jQuery plugin for work which pulls in RSS feed data using Google's Feed API. Using this API, I'm saving all of the relevant RSS feed data into an object, then manipulating it through methods. I have a function which is supposed to render the RSS feed onto the webpage. Unfortunately, when I try to display the individual RSS feed entries, I get an error. Here's my relevant code:</p>

<pre><code>var RSSFeed = function(feedTitle, feedUrl, options) {
/*
 * An object to encapsulate a Google Feed API request.
 */

// Variables
this.description = "";
this.entries = [];
this.feedUrl = feedUrl;
this.link = "";
this.title = feedTitle;
this.options = $.extend({
    ssl : true,
    limit : 4,
    key : null,
    feedTemplate : '&lt;article class="rss-feed"&gt;&lt;h2&gt;{title}&lt;/h1&gt;&lt;ul&gt;{entries}&lt;/ul&gt;&lt;/article&gt;',
    entryTemplate : '&lt;li&gt;&lt;h3&gt;&lt;a href="{link}"&gt;{title}&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;by: {author} @ {publishedDate}&lt;/p&gt;&lt;p&gt;{contentSnippet}&lt;/p&gt;&lt;/li&gt;',
    outputMode : "json"
}, options || {});

this.sendFeedRequest = function() {
    /*
     * Makes the AJAX call to the provided requestUrl
     */

    var self = this;
    $.getJSON(this.encodeRequest(), function(data) {
        // Save the data in a temporary object
        var responseDataFeed = data.responseData.feed;

        // Now load the data into the RSSFeed object
        self.description = responseDataFeed.description;
        self.link = responseDataFeed.link;
        self.entries = responseDataFeed.entries;
    });
};

this.display = function(jQuerySelector) {
    /*
     * Displays the RSSFeed onto the webpage
     * Each RSSEntry will be displayed wrapped in the RSSFeed's template HTML
     * The template markup can be specified in the options
     */

    var self = this;
    console.log(self);
    console.log(self.entries);
};
};

$.rssObj = function(newTitle, newUrl, options) {
    return new RSSFeed(newTitle, newUrl, options);
};

// Code to call the jquery plugin, would normally be found in an index.html file
rss = $.rssObj("Gizmodo", "http://feeds.gawker.com/Gizmodo/full");
rss.sendFeedRequest();

rss.display($('div#feed'));
</code></pre>

<p>Obviously, my <code>display()</code> function isn't complete yet, but it serves as a good example. The first <code>console.log()</code> will write all of the relevant data to the console, including the <code>entries</code> array. However, when I try to log the <code>entries</code> array by itself, it's returning an empty array. Any idea why that is?</p>
