← #44 Use short-circuits conditionals
#45

Get the current timestamp

Topics: JavaScript

There are a few ways to get the current timestamp. All method return the number of milliseconds:

new Date().getTime();

Date.now();

// These method are the same
// The unary operator (`+`) calls the `valueOf` method automatically
+new Date();
new Date().valueOf();

Take a look at this snippet if you want to get the current time in seconds.

Fix a typo or suggest an improvement
#46 Log an array to the Console