Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Tried to search but nothing obvious showed up. What's the purpose of the 1 in '1 * new Date()'?

Edit: found it. Gets the timestamp[1]

1. https://stackoverflow.com/questions/24182317/multiplication-...



Right, back to the point of saving characters/bytes at scale it's a cheaper way to getTime()


And if you don't need to support IE8 or lower, you can use Date.now()


Some do analytics tools use +new Date instead




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: