Problem
function calculateTotalCost(mealCost, taxRate = 0.1, tip = 0) {
  arguments[1] = 0.15;
  arguments[2] = arguments[2] + 5;

  let totalCost = mealCost + mealCost * taxRate + tip;
  return totalCost;
}

let total = calculateTotalCost(50, undefined, 10);
console.log(total);
Solution

The answer is 65. MDN explains “Non-strict functions that are passed rest, default, or destructured parameters will not sync new values assigned to parameters in the function body with the arguments object.”

If we remove the default parameters we get a different answer:

function calculateTotalCost(mealCost, taxRate, tip) {
  arguments[1] = 0.15;
  arguments[2] = arguments[2] + 5;

  let totalCost = mealCost + mealCost * taxRate + tip;
  return totalCost;
}

let total = calculateTotalCost(50, undefined, 10);
console.log(total);

The answer with no default params is 72.5 (50 + 7.5 + 15).