Standard built-ins

Reflect.ownKeys()

Try the free JavaScript compiler

Returns all own string and symbol keys including non-enumerable ones. Throws for a non-object target. For ordinary objects the key order follows ordinary own-key ordering.

Formal Syntax & Structure

javascript syntaxjavascript
Reflect.ownKeys(target)

Parameters & Attributes

NameTypeDescription
objObjectTarget object.

Return Value

Array

Own property keys.

Working Example

Example Snippetjavascript
const s=Symbol();const o={a:1,[s]:2};console.log(Reflect.ownKeys(o).length);
JavaScript Reference