ps.
ps.

Reputation: 4360

explore properties and/or functions of javascript objects

Is there any way i can explore the properties and /or functions of a java script object(Like a telerik menu or anyother 3rd party object)? the way i can by debugging and breaking and then adding an object in the watch or by using intellisense in VS.

I use vs2008 and i do have the basic intellisense for javascript.

I think i will be able to get a lot more done if i could do it.

Upvotes: 2

Views: 2821

Answers (2)

Tim Goodman
Tim Goodman

Reputation: 23976

I'm not sure if this is what you have in mind, but you can iterate through the members of an object like so:

var myObj = {a: 42, b:"blah", c: function(){alert("hello world");}};

for(var member in myObj){
  console.log("Name: " + member);
  console.log("Value: " + myObj[member]);
}

Upvotes: 5

Matt
Matt

Reputation: 41832

A personal favorite of mine is to do it directly in browser, using Firefox and the Firebug extension/plugin.

You can set breakpoints, and explore the javascript object itself, as well as DOM elements, from the plugin window. You also get a handy console/interpreter for exploring or executing arbitrary JS (such as to manually trigger a method, or an AJAX call).

Upvotes: 5

Related Questions