Take the 2-minute tour ×

This line:

alert("<b>feeds.entries["+j+"] is </b>=>"+feeds.entries[j]+"<br>");

gives this result:

<b>feeds.entries[0] is </b>=>[object Object]<br>

I would like to print the list of objects so that I can use them.

This array is being called as such:

var entry=feeds.entries[i];

and entry.title, prints the title of the image. I guessed at "title", and would like to see all the other objects feeds.entries[] contains, but my alert above, prints "[object Object]". The script is zRSSFeed which is an RSS parser. I'm trying to parse a Menalto Gallery 2 (or g2) RSS feed.

share|improve this question
Post the code where you construct the feeds and entries objects. –  Jeroen Jul 19 '11 at 17:24
add comment

5 Answers

up vote 1 down vote accepted
function join(obj) {
    var ret = '';
    for (var i in obj) {
        if (!obj.hasOwnProperty(i)) continue;
        ret += i + ': ' + obj[i]
    return ret;

Call it like this:

alert("<b>feeds.entries["+j+"] is </b>=>"+join(feeds.entries[j])+"<br>");


share|improve this answer
add comment

You can't render string and object together as they are different type. do print object separately alert(feeds.entries[j]). I think it is good to use console.log instead of alert for debugging.

share|improve this answer
add comment

I suggest you download and install Firebug, then read the section on Firebug and logging. It will show you how to log to the console.

I'm also a fan of the YUI 2 Logger which displays the messages in a floating window. Either way, using alert is a sure way to slow down development and drive yourself insane. Development should be more fun than that.

As an aside, take a look at the YAHOO.lang.dump() method which shows what is inside an object. [Object object] isn't very useful as you've discovered.

share|improve this answer
add comment

if you mean to use them in the browser console, use

for (var i==0; i<feeds.entries.length; i++){

otherwise, please explain more clearly what you want, and how you want to represent your objects or their attributes.

share|improve this answer
add comment

Try outputting it as JSON:

alert("<b>feeds.entries["+j+"] is </b>=>"+JSON.stringify(feeds.entries[j])+"<br>");

I don't see why you have the tags in the alert though, as they do nothing.

alert("feeds.entries["+j+"] is =>" + JSON.stringify(feeds.entries[j]));

However, if you are using Chrome, I suggest you simply console.log the object(s) and open up the developer console to view the object.

share|improve this answer
I don't know how to find, activate, use, etc. the "console log" –  sandraqu Jul 19 '11 at 17:32
If you're on Mac, Cmd+Alt+j. Windows is probably Ctrl-Alt-j. Otherwise, just go to View -> Developer -> Javascript console. –  Håvard Jul 19 '11 at 17:34
add comment

Your Answer


