I would like to add different worker values of each sector but multiply that value by another key:value property . This is a Vue.js composition API webapp.
export default {
setup( props, {emit}) {
let data = reactive({
let chosenCompanies: [
{ id: 'Big', workers: 250, clones: 9 },
{ id: 'Medium', workers: 75, clones: 2 },
{ id: 'Small', workers: 10, clones: 6 },
{ id: 'Individual', workers: 1, clones: 7}
]
});
const employedWorkers = () => {
let employedworkersPrivate = 0;
data.chosenCompanies.forEach(function(sector){
for (const [key, value] of Object.entries(sector)) {
if (key === 'workers') {
employedworkersPrivate += parseInt(value)
// I need to multiply the number of workers per clones here, instead of just adding more workers
// can I get to the key 'clones' value here?
}
}
})
return employedworkersPrivate
}
}
}