Skip to content

Latest commit

 

History

History
16 lines (14 loc) · 310 Bytes

count-properties-in-object.md

File metadata and controls

16 lines (14 loc) · 310 Bytes
title description author tags
Count Properties in Object
Counts the number of own properties in an object.
axorax
object,count,properties
function countProperties(obj) {
  return Object.keys(obj).length;
}

// Usage:
const obj = { a: 1, b: 2, c: 3 };
countProperties(obj); // Returns: 3