Fellow Stranger Fellow Stranger - 2 months ago 11
Javascript Question

I want to display an object's values in chrome's console

It's something I'm missing in Chrome's console. I'm following a screencast where a javascript object is displayed in a browsable tre-like structure like this:

(arrow here) Object

When typing this for example, I'm only getting an empty array:

jQuery()

Answer

If you want to browse the elements within the jQuery object, you'll have to select something first.
$() returns an empty jQuery object.


If, on the other hand, you want to browse the methods/properties of the object created, you should use the console.dir method, which will give you a more in-depth view of your object:

console.dir(jQuery());

Here's the fiddle: http://jsfiddle.net/asYay/