r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

3

u/robolab-io Mar 19 '19

Eh not that great but (new Date().getTime()) is my quick way to get Unix time in one line

8

u/GBcrazy Mar 19 '19

You can do this with Date.now()

1

u/robolab-io Mar 19 '19

Lmfao, I knew I was missing something. Thanks. Tomorrow I'm going to ninja edit the few places I wrote this.

0

u/dwighthouse Mar 19 '19

Literally equivalent to Date.now().