In JS how do I list the contents of an "object" or "array"?

Asked

Viewed 192 times

0

I have this unknown object and I need to work with it, so I tried using the console:

console.log('01 =', this);

but only one returns to me "01 = Object { length: 1, 1 more… }"

How to do this? or... what would be the equivalent of php’s "print_r"?

thank you!

ps: a detail I didn’t understand well... eh that "1 more... " there in the result.... can be clicked, and the Mozilla... displays a giant information on the page... but I found nothing on variables or information from my data..

1 answer

-1

Try this:

console.log('index:' + i); console.log(this);

  • The first line I set to represent the index of a for, if you haven’t just put this line:console.log(this);

  • I don’t know if I’m talking nonsense... but it looks exactly like the code I mentioned in the question... no?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.