# Réponse finale obtenue du bot:
response = « Here’s an example of a JavaScript function that you could use to calculate the salary for an ambulancier or ambulancière based on their years of experience and any strategic alliances they may have:
« `
function calculateSalary(yearsOfExperience, strategicAlliance) {
let baseSalary = 0; // set the starting salary to 0
if (strategicAlliance === true) {
// add a bonus for having a strategic alliance
baseSalary += 5000;
}
switch(yearsOfExperience) {
case 1-3:
baseSalary = yearsOfExperience * 2000 + 10000; // 1-3 years of experience: $20,000-$50,000
break;
case 4-7:
baseSalary = yearsOfExperience * 3000 + 15000; // 4-7 years of experience: $30,000-$60,000
break;
case 8+:
baseSalary = yearsOfExperience * 4000 + 20000; // 8 years or more of experience: $40,000-$100,000
break;
}
return baseSalary; // return the calculated salary
}
« `
You can use this function by passing in the number of years of experience and a boolean value indicating whether or not the ambulancier or ambulancière has a strategic alliance. For example:
« `
let salary = calculateSalary(5, true); // calculate the salary for an ambulancier with 5 years of experience and a strategic alliance
console.log(salary); // should output: 10000
« ` »