Skip to content

countKeys ​

The countKeys() method counts the number of an object's keys while ignoring internal keys.

Interactive example ​

Syntax ​

typescript
function countKeys<
	GenericObject extends object
>(
	object: GenericObject
): number

Parameters ​

  • object: The object whose keys you want to count.

Return value ​

The number of the object's keys, excluding internal keys.

See also ​

  • keys - Returns an array of an object's keys
  • values - Returns an array of an object's values
  • entries - Returns an array of key-value pairs

Sources ​

Released under the MIT license.