node.js中的console.timeEnd方法使用说明
方法说明:
完成时间,执行 console.time 到 console.timeEnd 之间所花费的时间。
语法:
console.timeEnd(label)
接收参数:
Label 与开始时间 console.log 的 label 对应
例子:
console.time('100-elements'); for (var i = 0; i < 100; i++) { ; } console.timeEnd('100-elements');
源码:
Console.prototype.timeEnd = function(label) { var time = this._times[label]; if (!time) { throw new Error('No such label: ' + label); } var duration = Date.now() - time; this.log('%s: %dms', label, duration); };
node.js中的console.time方法使用说明
方法说明:开始时间,与console.timeEnd对应,记录时间段。语法:console.time(label)接收参数:Label与开始时间console.log的label对应例子:console.time('100-elements')
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],[...])接收参数:接受若干个参数,如果只有一个参数,
标签:方法,参数,时间,语法,使用说明