I'm looking to build an object comprised of nested arrays that will resemble the following structure:
[{"name":"Joe","role":["Admin","Developer"]},{"name":"Sherry","role":["Analyst","QA-tester"]}]
My goal is to be able to access and modify the roles array for a specific individual, like Sherry, by adding additional values. How can I achieve this?
employees = [];
// [*retrieve names and associated roles from database*]
employees.push({name: exampleVar1, role: exampleVar2});
Desired outcome: I aim to save names in order to append corresponding roles for each employee, then utilize this object as a point of reference later on.