Using JavaScript flatmap with array properties
I have the following data structure : var companies = [{name: 'company 1', depts : ['dept1', 'dept2'], address: 'address1'}, {name: 'company 2', depts : ['dept2', 'dept3'], address: 'address2'},]; I want to repeat the company for each department, so I want…