JS call method _ apply method _ caller attribute _ callee attribute
Address: http://aweber.blogbus.com/logs/46751586.html
I. Call MethodCall a method of an object to replace the current object with another object (in fact, it is to change the internal pointer of the object, that is, to change the content pointed to by this object ).JS Code
Call ([thisobj [, arg1 [,Arg2 [,[,. Argn])
ParametersThisobjOptional. Will be used as th
Today, I will introduce the call attributes of a function through an example.Example:Function whocallme (){Alert ("My caller is" + whocallme. Caller );};Function callera () {whocallme ();};Function callerb () {whocallme ():};Alert {whocallme. Caller}; // The output result is: NULL;Whocallme (); // The output result is: My cal
, and when you call the function testaguments, you will find that "undefined" is displayed, indicating that the property is not arguments. That is, arguments is not an array object.CallerReturns a reference to the function that called the current function.Functionname.callerThe FunctionName object is the name of the function being executed.DescriptionFor a function, the caller property is defined only when the function executes. If the function is cal
array object.Here is a simple way to add a recommendation: Alert (arguments instanceof Array);Alert (arguments instanceof Object);CallerReturns a reference to the function that called the current function.Functionname.callerThe FunctionName object is the name of the function being executed.DescriptionFor a function, the caller property is defined only when the function executes. If the function is called by the top level, then
"undefined" is displayed, stating that the attribute is not arguments. That is, arguments is not an array object.
Here is a simple way to add the recommended: alert (arguments instanceof Array);
Alert (arguments instanceof Object);
Caller
Returns a reference to a function that calls the current function.Functionname.callerThe FunctionName object is the name of the function being executed.
DescriptionFor functions, the
myfunc=function (x, y) {var a= "MyFunc";alert (THIS.A);Alert (x + y);}Myfunc.call (func, "var", "fun");//"Func" "var fun"Myfunc.apply (func,["var", "Fun"]);//"Func" "var fun"Third, caller propertiesReturns a reference to a function that invokes the function body of the current function.The FunctionName.caller:functionName object is the name of the function being executed.DescriptionFor a function, the caller
Directory
Introduction
Generation example
Conclusion
Other resources
This article is the second part of a series of articles describing how to use Business Connectivity Services to create and implement declarative Web Services (four parts in total ).
WCF: Build a WCF Web Service for SharePoint 2010 Business Connectivity Services (part 1, part 4)
WCF: determine the identity of the caller in the WCF Web Service (part 1, Part 4 in total) (this
1:caller returns a reference to a call to the current function returns null if it is called by the top level(For a Li Ziha caller to call you, who called you, and who calls you, obviously, the following is the execution of a function. Only when you call, do you know who the caller is, so for a function only caller exis
is not arguments. That is, arguments is not an array object.Here is a simple way to add a recommendation: Alert (arguments instanceof Array);Alert (arguments instanceof Object);CallerReturns a reference to the function that called the current function.Functionname.callerThe FunctionName object is the name of the function being executed.DescriptionFor a function, the caller property is defined only when the function executes. If the function is called
1:caller returns a reference to a call to the current function returns null if it is called by the top level(For a Li Ziha caller to call you, who called you, and who calls you, obviously, the following is the execution of a function. Only when you call, do you know who the caller is, so for a function only caller exis
that the property is not arguments. That is, arguments is not an array object.CallerReturns a reference to the function that called the current function. M.mlyrx120.comFunctionname.callerThe FunctionName object is the name of the function being executed.DescriptionFor a function, the caller property is defined only when the function executes. If the function is called by the top level, then caller contains
necessary to note that the JavaScript function does not check the type and number of parametersArguments Property callee (JavaScript 1.2 new property)The callee property of the actual parameter object references the function that is currently executing. This is useful when the unnamed function calls itself recursively(function(x) {// to find the factorial if of x (typeof x = = "number" x >0 { return x * Arguments.callee (x-1); } return 1; // when x equals 0 o'clock Output 1})
=function (x, y) {var a= "myfunc"; alert (THIS.A); alert (x + y ); } myfunc.call (func, "var", "fun");//"Func" "var Fun" myfunc.apply (func,["var", "fun"]);//"Func" "var fun" three, the caller property returns a reference to a function that invokes the function body of the current function. The FunctionName.caller:functionName object is the name of the function being executed. Description: For a function, the call
, arguments is not an array object.CallerReturns a reference to the function that called the current function.Functionname.callerThe FunctionName object is the name of the function being executed.DescriptionFor a function, the caller property is defined only when the function executes. If the function is called by the top level, then caller contains null. If you use the
Script Language
=
"
Javascript
"
>
/** Demonstrate the usage of arguments and how to obtain real parameters and number of shapes*/
Function
Argtest (A, B, C, D)
{ VaR Numargs = Arguments. length; // Obtain the value of the passed parameter. VaR Expargs = Argtest. length; // Obtain the expected value. Alert ( " The number of real parameters is: " + Numargs)Alert ( " Number of shapes: " + Expargs)Alert (arguments [ 0 ])Alert (argtest [ 0 ]) //
C # obtain Caller information,
When a log component is used, the caller information is often recorded. The caller information is usually obtained through reflection. However,. Net 4.5 introduces three new features: CallerFilePathAttribute, CallerLineNumberAttribute, and CallerMemberNameAttribute. These three features can only be applied to parameters and can onl
Keyword: arguments, callee, callerarguments: the input function parameter callee: The statement of the function and the function body caller: the function that calls the Function
Arguments
This object represents the function being executed and the parameters of the function that calls it.CallerReturns a reference to the function that calls the current function.FunctionName. callerThe functionName object is the name of the executed function.Description
You should use "attributes" to address caller and callee, not methods.Caller: Returns a reference to the function that called the current function. A calls B, then returns a (A is the boss, because a B calls the past to work);Callee: This attribute holds B (b is called past). Returns the function object being executed, which is the body of the specified function object.If the function is called by the top level of the Javascript program, then
There is no call to belong to such calls we do not know where to call, this function is not really okay but have obsessive-compulsive disorder friends may feel to show, then how to open the function of the caller, the specific let's take a look at it.
1. Under the Standby page, click "Application".
2. Click "Set".
3. Slide up the screen and click on "Call".
4. Click on "Caller
function B caller calls the function of the current function B to reference a (that is, to the parent function A of the current function B), so the result is a popup function a () {B ();};So you know caller and callee, then you can not combine the two together to use itFunction B () {alert (B.caller);};From this code you can see that the B function called the B function name, so that when the function name
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.