2

enter image description here

How do you get the size this object? I want to loop through each object within the parent object.

Suren Srapyan
  • 66,568
  • 14
  • 114
  • 112
doso13
  • 31
  • 1
  • 2
  • 2
    How you define size? number of properties? Is that just in the top-level object or do you need to descend into child properties? does it include prototype properties? Or are you interested in the amount of memory that the object retains? – joews Oct 26 '16 at 19:35

1 Answers1

4

To count the number of owned properties:

Object.keys(users).length
trincot
  • 317,000
  • 35
  • 244
  • 286