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>