Skip to content

keysOf

keysOf<T>(obj): KeysOf<T>

Returns the names of the enumerable string properties and methods of an object.

Example

keysOf({foo: "bar"})
// => ["foo"]
keysOf({})
// => []

Alternatives

Type Parameters

T extends object | ArrayLike<unknown>

Parameters

obj

T

The object to get the keys from.

Returns

KeysOf<T>

The keys as an array.