代码:
var start = new Date().getTime(); // 起始时间 var end = new Date().getTime(); // 结束时间 return (end - start) + "ms"; // 返回函数执行需要的时间