AD · 728×90
Google AdSense / Яндекс.Директ
Google AdSense / Яндекс.Директ
Object
Object.keys()
Returns an array of a given object's own enumerable property names
Object to inspect
Object.keys(obj)
RESULT
— click Run or press Ctrl+Enter —
Parameter Reference
| Parameter | Type | Status | Description |
|---|---|---|---|
| obj | object | required | Object 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
- Only own enumerable properties — inherited and Symbol keys are excluded
- for Symbol keys use Object.getOwnPropertySymbols()
- to iterate over pairs: Object.entries(obj).forEach(([key, val]) => ...).