<!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