Object.keys()
AD · 728×90
Google AdSense / Яндекс.Директ
Object
Object.keys()
Returns an array of a given object's own enumerable property names
→ ArrayPHP: array_keys()ES5+
objobject
Object to inspect
Object.keys(obj)
RESULT
— click Run or press Ctrl+Enter —
Parameter Reference
ParameterTypeStatusDescription
objobjectrequiredObject to inspect
About

Object.keys() returns an array of strings with the names of the object's own enumerable properties (not inherited). Together with Object.values() and Object.entries() it forms a convenient toolkit for object iteration. Key ordering: integer keys ascending, then string keys in insertion order.

Browser Support

Introduced in ES5 (2009). Object.values() and Object.entries() added in ES2017. Object.fromEntries() added in ES2019. Supported by IE9+.

Tips & Gotchas