/ Published in: JavaScript
Javascript time execution utility:
Use:
var otd = new timeDebugger();
otd.start();
alert(otd.end());
Use:
var otd = new timeDebugger();
otd.start();
alert(otd.end());
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function timeDebugger() { }; timeDebugger.prototype.d = new Date(); timeDebugger.prototype.t = new Date(); timeDebugger.prototype.start = function() { this.d = new Date(); this.t = this.d.getTime(); }; timeDebugger.prototype.end = function() { this.d = new Date(); return (this.d.getTime() - this.t); };