const programmers = [
{ name: 'John', position: 'Senior Developer', salary: 5000 },
{ name: 'Alice', position: 'Junior Developer', salary: 2500 },
{ name: 'Bob', position: 'Intern', salary: 1000 },
{ name: 'Mike', position: 'Lead Developer', salary: 7000 }
];
const updatedProgrammers =
programmers.map (programmer => {
let salaryMultiplier = 1;
if (programmer.position === 'Lead Developer') {
salaryMultiplier = 2;
} else if (programmer.position === 'Senior Developer') {
salaryMultiplier = 1.7;
} else if (programmer.position === 'Junior Developer') {
salaryMultiplier = 1.5;
} else if (programmer.position === 'Intern') {
salaryMultiplier = 1.3;
}
return {
...programmer,
salary: programmer.salary * salaryMultiplier
};
});
console.log(updatedProgrammers);