Hello there!
Within nested json-files, I have been utilizing the following function for iteration:
function organizePeopleGroups(People, container, parentObject) {
_.each(People, function (item, index) {
var peopleGuid =[];
for (var peopleIterator= 0; peopleIterator< People.length; peopleIterator++) {
peopleGuid[peopleIterator] = People[peopleIterator].Id;
}
item.parent = parentObject;
//switch different people
switchPerson(item.Name, parentObject, peopleGuid [index]);
if (item.People) organizePeopleGroups(item.People, container, item);
});
};
However, I am encountering an issue... The 'peopleGuid' attribute is inaccessible outside of the for-loop due to scope limitations. How can I efficiently pass this value into the 'switchPerson' function? Appreciate your help!