Function.toString() : Function Object « Function « JavaScript Tutorial






The toString() method is used to convert a function to string.

The method converts the function back to the JavaScript source.

The converted string includes all aspects of the defined function.

<html>
    <body>
    <script lanuguage="JavaScript">
    <!--
    function writeText(){
         document.write("Some dummy text");
    }
    var func = writeText.toString();

    document.write("The string representation of the writeText");
    document.write(" function looks like: " + "<br><br><b>");
    document.write(func + "</b>");
    -->
    </script>
    </body>
    </html>








7.2.Function Object
7.2.1.Function() (capital F)
7.2.2.Function.apply()
7.2.3.Function.arguments
7.2.4.Function.arity
7.2.5.Function.call()
7.2.6.Function.caller
7.2.7.Function.prototype
7.2.8.Function.toSource()
7.2.9.Function.toString()