As we talked about earlier, in JavaScript, you can only return a single value from a function. So, when you want to return multiple values, you just return an object that contains those values.
function doAllTheMath(x, y) {
const sum = x + y;
const difference = x - y;
const product = x * y;
const quotient = x / y;
return {
sum,
difference,
product,
quotient,
};
}
const results = doAllTheMath(10, 5);
console.log(results.sum);
// 15
console.log(results.difference);
// 5
console.log(results.product);
// 50
console.log(results.quotient);
// 2
Fix the bug with the calculateCampaignMetrics so that it returns all the defined metrics correctly.