I have a function e.g.
var test = function () {alert(1);}
How can I get the body of this function?
I assume that the only way is to
Try this:
/\{(\s*?.*?)*?\}/g.exec(test.toString())[0]
test.toString() will hold your entire declaration.
/{(\s*?.?)?}/g will match everything between your braces