0

I have 'n' number of objects

obj1 = { 
   "foo":[],
   "bar":[]
}
obj2 = { 
   "foo":[1,2,3],
   "bar":['a','b','c']
}

…and so on.

Now let's say I want to pass obj1 or obj2 to a function to process the object as follows:

process_object('obj2');

how then does one accurately reference (for example) obj2.bar[1]

function process_object(this_object_obj){
   console.log(this_object_obj.bar[1]); // should = b
}
Michael Nelles
  • 5,426
  • 8
  • 41
  • 57

0 Answers0