How to view function body in node.js?

I only get [Function] when I try to display a function:

> var a = function(){ return 'toto'; } undefined > a [Function] > require('util').inspect(a) '[Function]' 
+6
source share
1 answer

Use toString :

 > var a = function(){ return 'toto'; } undefined > a.toString() 'function (){ return \'toto\'; }' 
+15
source

Source: https://habr.com/ru/post/920477/


All Articles