Basic Javascript tutorial-Definition and function call-basics-js tutorial

Source: Internet
Author: User
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:



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.