Created
December 15, 2015 00:18
-
-
Save sorenlouv/b43e61c8b1423ad1a106 to your computer and use it in GitHub Desktop.
Measure time since start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getTime = (function() { | |
var start = new Date().getTime(); | |
return function () { | |
var end = new Date().getTime(); | |
var time = end - start; | |
return time; | |
}; | |
})(); | |
console.log('time', getTime()); | |
setTimeout(function(){ | |
console.log('time', getTime()); | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment