广州葆元健康生物科技有限公司


node.js中的console.time方法使用说明

网络编程 node.js中的console.time方法使用说明 06-21

方法说明:

开始时间,与console.timeEnd对应,记录时间段。

语法:

console.time(label)

接收参数:

Label 与开始时间 console.log 的 label 对应

例子:

console.time('100-elements');

for (var i = 0; i < 100; i++) {

  ;

}

console.timeEnd('100-elements');

源码:

Console.prototype.time = function(label) {

  this._times[label] = Date.now();

};

node.js中的console.trace方法使用说明
方法说明:向标准错误流输出当前的调用栈。语法:console.trace(label)接收参数:label例子:console.trace();//运行结果:Trace:atObject.anonymous(/home/byvoid/consoletrac

node.js中的console.info方法使用说明
方法说明:该方法与console.log()相同。从源码看,它是直接调用console.log的。语法:console.info([data],[...])接收参数:接受若干个参数,如果只有一个参数,

node.js中的console.warn方法使用说明
方法说明:该方法与console.error()相同。看源码就知道,console.error其实就是直接调用console.warn的语法:console.warn([data],[...])接收参数:console.log接受若干个


编辑:广州葆元健康生物科技有限公司

标签:方法,参数,语法,使用说明,源码