I have created a dynamic array of objects which is created through inquirer. But I cannot figure out how to access a specific object in the array EDIT: this is how the console has logged my array
So for example, how can I access the 2nd Engineer (Mark)?
Keep in mind the array will change depending on the user input
team = [
Manager {
name: 'Nicole',
id: '1',
email: '[email protected]',
officeNumber: '5'
},
Engineer {
name: 'Zoe',
id: '2',
email: '[email protected]',
github: 'zozo'
},
Engineer {
name: 'Mark',
id: '3',
email: '[email protected]',
github: 'emman'
},
Engineer {
name: 'Joe',
id: '4',
email: '[email protected]',
github: 'joey'
}
Intern {
name: 'Seb',
id: '5',
email: '[email protected]',
school: 'UWA'
}
]
forloop to check each object in theteamarray and look for the object wherename === "Mark". That way it will keep working if more objects are added.Manager,Engineer, andIntern? Classes? Then doteam.filter((obj) => obj instanceof Engineer)[1].