toString()  Function  instance method JS Home  <<  JS Reference  <<  Function  <<  toString()

Description

Returns a string representation of the function.

This method overrides the toString() method of Object.

Syntax

Signature Description
aFunction.toString()Returns a string representation of the function.

Parameters

None.

Examples

The code below creates a function and displays it as a string.


// Create a function.
var newFunction = new Function('a', 'return a * a');
alert(newFunction.toString());

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 8 - Functions

JavaScript Basics

JavaScript Basics

JavaScript Intermediate

JavaScript Intermediate

JavaScript Advanced

JavaScript Advanced

JavaScript Reference

JavaScript Entities

Globals

Function

Class Properties
prototype
Instance Properties
constructor
length
Class Methods
None.
Instance Methods Getters
apply()
bind()
call()
toString()
Instance Methods Setters
None.

Statements

Operators