Last active
September 16, 2019 04:47
-
-
Save masautt/dc3b9ee9e9fe1b40f9ad1f53f4158006 to your computer and use it in GitHub Desktop.
How to keep track of time elapsed in JavaScript?
This file contains hidden or 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
let start = new Date(); | |
setTimeout(()=> { | |
console.log((new Date() - start) / 1000 + " seconds have passed"); // --> 5 seconds have passed | |
},5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment