Function
Function is...
Function definition = Function declaration
A function in a programming language is defined as a unit of execution by implementing a series of processes as statements and wrapping them in code blocks. Functions in the programming language also take input and send output. In this case, a variable receiving the input is called a parameter, an input is an argument, and an output is a return value. Also, since there may be several functions, you can use function names that are identifiers to distinguish specific functions.
As a function of mathematics, you need to direct the execution of a function by passing parameters, such as arguments, that are needed to execute a predefined set of processes, to the function. This is called function call / invoke. When a function is called, the statements in the code block are executed in a lump and the result is returned.
Function Feature
It is used for efficient reuse of code.
Increases code reliability and improves readability.
Function contained parameter and argument
JavaScript function are first-rate objects
A function can be evaluated to be a value, and a function that can be evaluated as a value can be assigned to a variable.
A function can specify a property and invoke a method.
1. Function Definition
Function Structure
Function Name
The function name must follow the naming convention as an identifier.
Function names can only be referenced inside functions.
The function name can be omitted. [ Named function / Anonymous function ]
Parameter
Parameter can use it as a variable inside a function.
Wrap zero or more parameters with "( )" and separate them with " , ".
Parameters are assigned arguments.
Function Body
It is a block of code defined as a unit in which a function is executed.
The function execute by invoke.
1.1 Function Declarations
1.2 Function Expressions (Function literal)
1.3 Constructor Function
1.4 Arrow Function
2. Function Hosting
3. First-class Object
4. Parameter / Argument
4.1 Call-by-value
4.2 Call-by-reference
5. Return Value
6. Function Object Property
6.1 argument Property
6.2 caller Property
6.3 length Property
6.4 name Property
6.5 __proto__ Property
6.6 prototype Property
7. Different Type of Function
7.1 Call back Function
7.2 Recursive function
7.3 Inner Function
7.4 Immediately-invoked function
Last updated
Was this helpful?