15.3.4.2 Function.prototype.toString()

2010-07-04

string Function.prototype.toString() throws TypeError

This function actually has implementation dependent behaviour. Most browsers, for instance, will return the function definition, including the [[Source]], for functions created during the runtime. Native functions will just have "native code" as body. Host functions can have either, depending on browser and complexity.

The specification does not prescribe how to handle toString for Function.

It will throw a TypeError if this is not a function object.