Home >Web Front-end >JS Tutorial >Javascript Basic Tutorial: Defining and Calling Functions_Basic Knowledge
A function is a statement that can be run at any time. Simply put, a function is a set of statements that complete a certain function. It accepts 0 or more parameters.
The basic syntax of the function is as follows
Among them, function is the keyword of the custom function, functionName is the function name, arg represents the list of various parameters passed to the function, and each parameter is separated by commas. Parameters can be empty.
statement is a function native and can be any legal code block.
reture expression is the value expression of the returned function, which is also optional. A simple example is as follows.
In addition, javascript will no longer be executed after rerurn is executed.
There may be multiple returns in a function
The above is the entire content of this article. Do you guys have a new understanding of defining and calling javascript? I hope this article can be helpful to everyone