Get the milliseconds
console.log(+new Date());
console.log(Date.now());
At some point I got in the habit of doing +new Date()
. Not entirely sure why, Date.now()
is the clear choice. I guess maybe Date.now()
is newer…
confirmed… it is new, doesn’t work in much older browsers…