I have a general javascript question.
Let's say I have an array persons
of Person
objects. Each Person
has an ID, names, adresses, etc.
In my functions that process persons
, I usually pass the Person
object I'm manipulating. However this somehow feels wrong. Like I'm wasting memory.
So my question:
- Am I using extra memory by passing the objects instead of just their ID's?
- Is using getPersonByID() and just passing ID's instead a better option?
- How do you go about managing many instances of objects?