I have a really weird question that I don't know how it occurs.
When I reassign an argument with arguments[0] = 42. The arguments[0] and the first argument a are both 42. Which is expected.
function foo(a, b, c) {
arguments[0] = 42;
console.log(a, arguments[0]);
}
foo(1, 2, 3);
But when I tried with a function that has an argument with a default value, the first value a doesn't get reassigned anymore. Can someone explain this discrepancy?
function foo(a, b, c = 3) {
arguments[0] = 42;
console.log(a, arguments[0]);
}
foo(1, 2, 3);