Arguments is the argument list (object) when the function is run, each function has its own arguments, but does not look for the related properties of the arguments in the outer function, that is not the chain (only OA forms the scope chain).
Example 1
<script>(function(d, E, f) { console.log (arguments); Console.log (typeof arguments);}) (' JavaScript ', ' Programming ', '! ') ); </script>
Output in console
["JavaScript", "Programming", "!" ]object
Example 2 arguments collects all the arguments, even if there are no corresponding formal parameters
<script>(function(d, E, f) { console.log (arguments);}) (' JavaScript ', ' Programming ', '! ', ' node '); </script>
Output in console
["JavaScript", "Programming", "!", "Node"]
When a function is run, the variables that can be referenced inside the function are ①ao②arguments③this
Example 3-shape participation corresponds to a arguments unit that is mapped to each other
<script>(function(d, E, f) { Console.log (arguments[0]); arguments[0] = ' backbone '; Console.log (d);}) (' JavaScript ', ' Programming ', '! ', ' node '); </script>
Output in console
Javascriptbackbone
Example 4 arguments gets the number of arguments when the function is run
<script>(function(d, E, f) { console.log (arguments.length);}) (' JavaScript ', ' Programming ', '! ') ); </script>
Console output: 3
Functions that are currently running on the "Arguments.callee property"
Example 5
<script>(function(d, E, f) { console.log (Arguments.callee);}) (' JavaScript ', ' Programming ', '! ') ); </script>
Console output:
function (d, E, f) { console.log (Arguments.callee);}
Example 6
Use recursive summation
<script>function t (n) { if(n<=1) { return n; } Else{ return n + t (n-1); }} Console.log (t ()); </script>
Output: 5050
Recursion is now done using anonymous functions
<script>Console.log ( (function (n) { if(n<=1) { return n; } Else { return n + arguments.callee (n-1); } }) (+)); </script>
Output: 5050
Javascript notes and summaries (1-3) arguments