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"]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…