JavaScript work must Know (ix) function arguments and formal parameters

Source: Internet
Author: User

Outline
    • Function
    • Caller Returning function callers
    • Callee calls itself
function

function format

function Getprototynames (o,/*optional*/a)        {            a = a | | [];            For (var p in O)            {                a.push (p);            }            return A;        }

  

Caller

Func.caller Returning function callers

  function  Callfunc ()        {            if (Callfunc.caller)            {                alert (callfunc.caller.toString ());            } else            {                alert ("No function call");            }        }        function Handlecaller ()        {            callfunc ();        }        Handlecaller ();//Return Handler        Callfunc ();//no function call, return NULL, execute "no function call"

 

Callee

anonymous method Recursive invocation

Alert ((function (x) {           if (x <= 1) return 1;           return x * Arguments.callee (X-1);       } (10))); /362800

  

JavaScript work must Know (ix) function arguments and formal parameters

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.