JavaScript Function Basics

Source: Internet
Author: User

1. JavaScript Function Basics

  1. Defining methods

      

2. Methods for calling functions

    

3. Function methods

 Apply: Call the function as an array method to pass the parameter as an array to the method

Call: A method that invokes a function as an object to pass a set parameter to the method

ToString: Returns the string representation of a function

4. Arguments objects

arguments Object

Function: A list of parameters that hold arguments

Attribute: can only be initialized automatically within the function body using a subscript attribute but not an array function declaration

Property:

A) length Gets the lengths of the function arguments

B) callee Returns the function that is currently pointing

C) Caler Returns the name of the function that is calling the currently executing function

5. Function parameters

   Parameter type:

Parameters that are used when a parameter definition function receives the parameter passed when the parameter is called

Actual arguments passed to the function when the argument is called

Characteristics:

No limit on the number of parameters

Argument < parameter superfluous parameter = undefined

Argument > Parameter superfluous argument ignored

There is no limit to the data type of the parameter

Accessing a parameter array through a arguments object

Parameters are always passed by value

Basic type pass-through value

Reference type Address

6. Pointer identification

    This points to the current action object

Callee pointer to the function that the parameter collection belongs to

Prototype pointing to the prototype object that came with the function

Constructor points to the constructor that created the object

JavaScript Function Basics

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.