Availability
JavaScript 1.5; JScript 5.5; ECMAScript
v3
Synopsis
function.call(thisobj, args...)Arguments
thisobj
The object on which function is to be
invoked. In the body of the function,
thisobj becomes the value of the
this keyword.
args...
Any number of arguments, which will be passed as arguments to
function.
Returns
Whatever value is returned by the invocation of
function.
Throws
TypeError
If this method is invoked on an object that is not a function.
Description
call( ) invokes the specified
function as if it were a method of
thisobj, passing it any arguments that
follow thisobj in the argument list. The
return value of call( ) is the value returned by
the function invocation. Within the body of the function, the
this keyword refers to the
thisobj object.
Use Function.apply( ) instead if you want to
specify the arguments to pass to the function in an array.
Example
// Call the default Object.toString( ) method on an object that
// overrides it with its own version of the method. Note no arguments.
Object.prototype.toString.call(o);
See Also
Function.apply( )
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.