class method Object.keys
Object.keys(object) → Array
-
object
(Object
) – The object to pull keys from.
Returns an array of the object's property names.
Note that the order of the resulting array is browser-dependent — it
relies on the for...in
loop, for which the ECMAScript spec does not
prescribe an enumeration order. Sort the resulting array if you wish to
normalize the order of the object keys.
Examples
Object.keys();
// -> []
Object.keys({ name: 'Prototype', version: '1.6.1' }).sort();
// -> ['name', 'version']