contents   index   previous   next



Function toString()

syntax:

function.toString()

return:

string - a representation of the function.

 

description:

This method attempts to generate the same code that built the function. Any spacing, semicolons, newlines, etc., are implementation-dependent. This method tries to make the output as human-readable as possible. Note that the function name is always "anonymous", because the function itself is unnamed, even though the function object has a name. Also, note that this function is very rarely called directly, rather it is called implicitly through conversions such as global.ToString().

 

example:

var myFunction =  new Function("a", "b",

    "this.value = a + b");

Screen.writeln( myFunction );

 

// This fragment will print the following

// to the screen:

 

   function anonymous(a, b)

   {

      this .value = a + b

   }