JSFiddle - React, Tailwind, and code Playground
JavaScript
var companies= [{
name: 'Microsoft',
id: 1,
employees: [5 , 9]
}, {
name: 'Google',
id: 2,
employees: [1]
}, {
name: 'LinkedIn',
id: 3,
employees: [10]
}];
var Employees = []; //initialize
companies.forEach(function(company) {
if (company.name == "Microsoft"){
Employees = company.employees;
//whatever you like
Employees.forEach(function(id){
alert(id);
});
}
});