Standard built-ins
Object.getOwnPropertyNames()
Returns all own string keys, enumerable and non-enumerable, excluding symbols.
Formal Syntax & Structure
javascript syntaxjavascript
Object.getOwnPropertyNames(obj)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| obj | Object | Target object. |
Return Value
Array
Own string keys.
Working Example
Example Snippetjavascript
const o={};Object.defineProperty(o,"n",{value:2});console.log(Object.getOwnPropertyNames(o).join(","));