Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Objects
Function Object
Object.toString
METHOD: Function::toString
Function.
toString
()
The
toString
method returns a string which represents the source code of a function. This over-rides the
Object.toString
method. There are times when a function needs to be represented as a string, and the
toString
method is automatically called to do that. In this next example, the
document.write
statement requires the function Car to be represented as a string, so JavaScript automatically calls the
toString
method to produce the following output:
Code:
function car(make, model, year)
{this.make = make, this.model = model, this.year = year}
document.write(car)
Output:
function car(make, model, year) {this.make = make, this.model = model, this.year = year
With the built-in
Function
object the
toString
method would produce the following string:
function Function() { [native code] }
.
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information