nodejs function to string containing function's code
javascript, node.js
Solution
Functions already have a `toString()` method... so just `(function() {}).toString()` should work.
For example, in the node REPL:
> (function() { console.log("hello"); }).toString()
'function () { console.log("hello"); }'
Here's a link to some documentation.
Problem
I am really really new to nodejs. Is there any way to convert function content to string? Something like, if I have: ``` function() { .... } ``` I'd like to have "function() { .... }". Is such thing possible?