2019-01-05

Entry tags:

You can return a js function's source!

OMGOMGOMG, I just discovered javascript's Function.prototype.toString() method.

Example:

function foo (
  alert ( "Hello, World!" );
}

alert ( foo.toString ); 
... causes an alert pop-up to display with a text of function foo \n(\t alert ( "Hello, World!" );\n} (only with all those tabs and returns rendered correctly).

I think I am hyperventilating.

I am going to get in so much trouble with this.

Once I stop cackling maniacally and dancing around the house in ecstacy.