This article mainly introduces the definition of the basic Javascript tutorial and relevant information about calling functions. For more information, see the function as a statement that can be run at any time. To put it simply, A function is a set of statements used to complete a function. It accepts 0 or multiple parameters.
Basic Function syntaxAs follows:
The Code is as follows:
Function functionName ([arg0, arg1,... argN]) {
Statement
[Return [expression]
}
Function is the keyword of the custom function, functionName is the function name, arg indicates the list of parameters passed to the function, and each parameter is separated by a comma. The parameter can be null.
Statement is a function of this province. It can be a variety of valid code blocks.
Reture expression is the return function value expression, which is also optional. A simple example is as follows.
The Code is as follows:
Function sayName (yname ){
Document. write ("hello" + yname)
}
SayName (1, 112 );
In addition, javascript will not be executed after rerurn is executed.
The Code is as follows: