Call Method (Function) (JavaScript)

Source: Internet
Author: User

Reprint: http://msdn.microsoft.com/zh-cn/library/h2ak8h2y (v=vs.94). aspx

Invokes the method of an object, replacing the current object with another object.

Call ([thisobj[, arg1[, arg2[,  [, ArgN]]])

Parameters

Thisobj

Optional. The object that will be used as the current object.

Arg1, Arg2,, ArgN

Optional. The parameter list that will be passed to the method.

Note

The call method is used to invoke a method that represents another project. It allows you to change the function's this object from the initial context to the new object specified by Thisobj.

If the Thisobj parameter is not provided, the global object is used as the thisobj.

Example

The following code shows how to use the call method.

1 functioncallMe (arg1, arg2) {2Console.log (' This value: ' + This);3    for(varIinchcallme.arguments) {4Console.log (' arguments: ' +Callme.arguments[i])5   }6 }7 8CallMe (1, 2);9 //This value: [Object Window]Ten //arguments:1 One //Arguments:2 A  -Callme.call (' A ', ' B ', ' C ') - //This value:a the //arguments:b - //Arguments:c

Requirements

Supported in the following document modes: Quirks, Internet Explorer 6 standard mode, Internet Explorer 7 Standard mode, Internet Explorer 8 standard mode, Internet Explorer 9 standard mode, INT Ernet Explorer 10 Standard mode and Internet Explorer 11 standard mode. In addition, it is also supported in store apps (Windows 8 and Windows Phone 8.1).

Call Method (Function) (JavaScript)

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.