JavaScript functions

Time:2021-4-23

1. Essence:Encapsulate a sectionCan be called repeatedlyCode block executed

2. Statement
Named function(also known as custom function)Function function name () {}
Anonymous function (also known as function expression)Var variable name = function () {}

3. Call
Functions can be separatedCall each other, function name followed by ()

4. Parameters
Formal parameter (default undefined)Function function name (parameter 1, parameter 2...) {}
Argument: function name (argument 1, argument 2…)
Arguments: 1. Transitive arguments are built-in objects of functions; ②Pseudo arrayIt has the characteristics of length and index numberIndefinite formal parameter