Arguments,caller,callee's understanding

Source: Internet
Author: User

The arguments object represents the function being executed and the parameters of the function that called it, arguments is an array but similar

An array of objects that have the same access properties and methods as the array, which can be accessed by arguments[n] to the values of the corresponding individual parameters,

With the length property, it is important to note that the arguments object stores the arguments that are actually passed to the function and is available only at the beginning of the function.

Caller returns a reference to a function that invokes the current function. If the function is called by the top level, caller contains a value of NULL.

Callee returns the body of the Funciton object that is being executed, which is the object of the specified function. Callee is a member of the arguments that represents a reference to the function object itself.

Arguments.length is the length of the argument, and the arguments.callee.length is the length of the parameter. This allows you to determine if the parameter length is consistent with the argument length at the time of the call.

In a recursive function, the function contains a reference to itself, and the function name is simply a variable name.

Calling your own function name inside a function is equivalent to calling a global variable, at which point you can choose to use callee.

Arguments,caller,callee's understanding

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.