Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
A function’s parameters can be redefined inside the function either
directly, or by using the arguments
array. Take a look at the code below.
<!DOCTYPE html><html lang="en"><body><script>
var foo = false;
var bar = false;
var myFunction = function(foo, bar) {
arguments[0] = true;
bar = true;
console.log(arguments[0], bar); // logs true true
}
myFunction();
</script></body></html>
Notice that I can redefine the value of the bar
parameter using the arguments index or
by directly reassigning a new value to the parameter.