-
-
Save cho45/5e2d40aa0e31f36f44b039259a3caa8b to your computer and use it in GitHub Desktop.
Date.now() vs new Date().getTime()
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
document.body.textContent = new Date().getTime(); |
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
document.body.textContent = Date.now(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Date().GetTime() call a "new" objet and Date.now() call a function. So, if it is just to just the content, it is better to use Date.now().
However, if you want to memorize this time, it can be easier to use something like "time = new Date().getTime();"