node.js

关注公众号 jb51net

关闭
首页 > 网络编程 > JavaScript > node.js > node.js console.time方法

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

投稿:junjie

这篇文章主要介绍了node.js中的console.time方法使用说明,本文介绍了console.time的方法说明、语法、接收参数、使用实例和实现源码,需要的朋友可以参考下

方法说明:

开始时间,与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();
};

您可能感兴趣的文章:
阅读全文