3

When debugging JavaScript in Visual Studio 2008 and I use the ? command in the command window to list a JavaScript object's members I always get that ellipses {...}. Example:

>? Page_Validators 
{...}
    [0]: {object}
    [1]: {object}
    [2]: {object}
    [3]: {object}
    [4]: {object}
    [5]: {object}
    length: 6

I'm assuming these are the object's member functions. Is there a way to list the members in that {...} ? A one-liner command would be ideal.

Thanks.

Jason Bunting
  • 58,249
  • 14
  • 102
  • 93
John Grant
  • 522
  • 8
  • 17

1 Answers1

6

I just tried this and it works, with one caveat:

? (function () { var m = []; for (var p in Page_Validators) { if(typeof Page_Validators[p] == "function") { m.push(p); } } return m; })()

That will show you all of the methods that are part of the object, but none of the built-in inherited methods (like toString() or valueOf()).

Hope that helps.

Jason Bunting
  • 58,249
  • 14
  • 102
  • 93
  • If this works for you and no one offers a better solution, please mark this as the accepted answer; thanks. – Jason Bunting Oct 24 '08 at 22:14
  • This still evaluates to {...} in the visual studio command window. I also tried with a few other asp Ajax framework built in objects, static and dynamic, with the same result. I think I had tried this already. Maybe I'm missing something. – John Grant Oct 26 '08 at 01:05
  • Sorry I was using the code wrong, forgot to change the argument to typeof. does work well: >? (function () { var m = []; for (var p in Sys.Application) { if(typeof Sys.Application[p] == "function") { m.push(p); } } return m; })() {...} [0]: "updated" [1]: "raisePropertyChanged" etcetc – John Grant Oct 26 '08 at 01:26