How to get a functions's body as string?
function, javascript
Solution
If you're going to do something ugly, do it with regex:
A.toString().match(/function[^{]+\{([\s\S]*)\}$/)[1];
Problem
I want to know how to convert a function's body into a string? ``` function A(){ alert(1); } output = eval(A).toString() // this will come with function A(){ ~ } //output of output -> function A(){ alert(1); } //How can I make output into alert(1); only??? ```