node.js打印function

Posted Boom__Clap

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了node.js打印function相关的知识,希望对你有一定的参考价值。

var Person = function(name) {
this.name = name;
this.gender = [‘man‘, ‘woman‘];
}
console.log(Person);
console.dir(Person);
console.dir(JSON.stringify(Person));
console.log(typeof(Person));
console.log(Person.toString());

  

上面打印的结果:

[Function: Person]
[Function: Person]
undefined
function
function (name) {
   this.name = name;
   this.gender = [‘man‘, ‘woman‘];
}

  

可以采用toString()的方式对函数进行打印。

 

以上是关于node.js打印function的主要内容,如果未能解决你的问题,请参考以下文章