toString

Table of contents

  1. 1. Summary
  2. 2. Syntax
  3. 3. Parameters
  4. 4. Description
  5. 5. See Also
Table of contents
  1. 1. Summary
  2. 2. Syntax
  3. 3. Parameters
  4. 4. Description
  5. 5. See Also

 

Summary

Returns a string representing the source code of the function.

Method of Function
Implemented in JavaScript 1.1
ECMAScript Edition ECMAScript 1st Edition

Syntax

function.toString(indentation)

Parameters

indentation
Non-standard
The amount of spaces to indent the string representation of the source code. If indentation is less than or equal to -1, most unnecessary spaces are removed.

Description

The Function object overrides the toString method of the Object object; it does not inherit Object.toString. For Function objects, the toString method returns a string representation of the object.

JavaScript calls the toString method automatically when a Function is to be represented as a text value or when a Function is referred to in a string concatenation.

For Function objects, the built-in toString method decompiles the function back into the JavaScript source that defines the function. This string includes the function keyword, the argument list, curly braces, and function body.

Tags (0)

Edit tags
  • No tags

Attachments (0)

 

Attach file