Why doesn't the Node console display the function code?

node.js

node.js Problem Overview


In the Google Chrome console, if I type fn where fn is a function, then I get the code for fn. In the Node console, typing require.resolve simply prints out

[Function]

Why don't I get the function definition?

node.js Solutions


Solution 1 - node.js

From the comments: use fn.toString().

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRandomblueView Question on Stackoverflow
Solution 1 - node.jsRandomblueView Answer on Stackoverflow