tags:

views:

46

answers:

2

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.

+4  A: 

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).

Matt
The Web Inspector in Safari and Chrome works similarly. Very handy.
Jordan
I actually do use firebug but had never used it for js debugging. Thanks.
ps
+2  A: 

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]);
}
Tim Goodman
As others have said, there are also useful tools for exploring JS objects in many web browsers, but something like the above could be useful to you if you want to determine what properties an object has at runtime.
Tim Goodman
+1 This was pretty useful too!
ps