The arguments of JavaScript

Source: Internet
Author: User

One, Arguments.callee//Gets the function that is currently executing, that is, the function itself, often used to get the anonymous function itself

Syntax: Arguments.callee

        function (x) {            if (x < 2) {                return 1Elsereturn x * Arguments.callee (x-1// return Back to 6 3*2*1       

Second, arguments.length//Get the number of arguments passed to the function

Syntax: arguments.length

        function (x) {            return arguments.length;        }        function return//// return 2, the number of arguments expected by the functions. 

Three, argument[]//Index to get parameters, index starting at 0

Syntax: Arguments[index]

        function (x, y) {            document.write (arguments[0]);  Output 1, index 0 x, which is the 1            document.write ("<br/>" + arguments[1]) in this case; Output 2, index 1 is y, that is, 2        }        fun1 (in this case);  

The arguments of JavaScript

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.