I am thinking of one thing, since for(var i in obj)
can pretty much enumerate anything inside a DOM or javascript object, so are there any selfhosted javascript editor that use for ... in
to offer grammar auto-suggest, discover class property/methods, external API?
Edit1: Thanks guys for the grammar suggestion and non-enumerable functions, but what I looking for is an editor based on this idea.
Because some of the members would be non-enumerable, you'd have to use Object.getOwnPropertyNames
, and even walk the prototype chain a bit (using Object.getPrototypeOf
). Here's what I mean:
>>> Object.getOwnPropertyNames([]);
["length"]
>>> Object.getOwnPropertyNames(Array.prototype);
["length", "constructor", "toSource", "toString", "toLocaleString", ...]