Summary of the usage of arguments,caller,callee,apply in JS

Source: Internet
Author: User

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "UTF-8"><styletype= "Text/css">    *{padding:0;margin:0;}#img{position:Absolute;}</style></Head><Body>    <imgID= "img"src= "Img/xi.png">    <Scripttype= "Text/javascript"src= "Js/jquery-1.8.3.min.js"></Script>    <Scripttype= "Text/javascript">                functionArgtest (A, b) {vari,s= "The argtest function expected"; //number of arguments actually passed in            varNumargs=arguments.length; //expected number of parameters            varExpargs=argtest.length; Alert (Numargs+","+Expargs);  for(i= 0; I<Numargs;i++) {s+= "\ n Arg"+I+ "="+Arguments[i]+"";        } alert (s); }        functiontest1 (a,b,c) {//expected number of parametersalert (test1.length)}functionCallerdemo () {//This function object calleealert (arguments.callee.name)//The information of the function being called            if(callerdemo.caller) {vara=callerDemo.caller.toString (); varNamestr=CallerDemo.caller.name; //Debugger;alert (NAMESTR);//Handlecaller            }Else{alert ("This is a top function")            }        }        functionHandlecaller () {Callerdemo ();        } handlecaller (); //(argtest);        //test1 ();    </Script></Body></HTML>

Arguments

The object represents the function being executed and the parameters of the function that called it.

Summary of the usage of arguments,caller,callee,apply in JS

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.