I would like to automatically determine all of the properties (including the hidden ones) in a given Javascript object, via a generalization of this function:
ECMAScript 5th ed. defines Object.getOwnPropertyNames
that returns an array of all properties of the passed in object, including the ones that are non-enumerable. Only Chrome has implemented this so far.
Object.getOwnPropertyNames({a: 10, b: 2});
gives ["b", "a"]
(in no particular order)
Object.getOwnPropertyNames(Math);
gives ["LN10", "PI", "E", "LOG10E", "SQRT2", "LOG2E", "SQRT1_2", "LN2", "cos", "pow", "log", "tan", "sqrt", "ceil", "asin", "abs", "max", "exp", "atan2", "random", "round", "floor", "acos", "atan", "min", "sin"]