Basic tutorial _ basic knowledge about using JavaScript functions

Source: Internet
Author: User
This article mainly introduces the basic tutorial for using JavaScript functions. it is the basic knowledge of getting started with JavaScript. if you need it, you can refer to the function as a set of reusable code, it can be called anywhere in the program. This eliminates the need to write the same code again and again. This will help programmers write modular code. You can divide large programs in some small and easy-to-manage functions.

Like any other advanced programming language, JavaScript supports all the features required to write modular code using functions.

You must have seen the functions of alert () and write () in the previous chapter. We use these features again and again, but they have been written only once in core JavaScript.

JavaScript allows us to write our own functions, and this section describes how to write our own functions in JavaScript.
Function definition:

Previously we used functions, so we need to define a function. The most common method to limit JavaScript functions is to use the function keyword, followed by a unique function name, a list of parameters (which may be empty), and a statement block surrounded by braces. The basic syntax is as follows:

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.