Subj : Re: Getting all properties of an JS object To : Alex Lee From : Brendan Eich Date : Tue Jan 25 2005 10:14 am Alex Lee wrote: > Does anyone know how to get all properties (name and value) within my C > code of an object defined via JS_DefineProperties() in SpiderMonkey? It dependes. If you pass JSPROP_ENUMERATE, then a for/in loop will work. If you want to enumerate all properties including the ones that are not enumerable (by for/in), then you need to use jsdbgapi.h. > Similarly, is there any way to get all properties (name and value) > within my C code of an object defined via a JavaScript snippet within my > JSContext, i.e. if I executed a snippet such as: > > a = new Object(); a.b = 1; a.c = "foo" All user-set properties are enumerable, so for (var i in a) ...; will iterate i over "b" and "c". /be .