No Time to Read - Copy/Paste Solution

function getCurrentTimestamp () {
return Date.now()
}

Explained

The UNIX timestamp is defined as the number of seconds since January 1, 1970 UTC. In JavaScript, in order to get the current timestamp, you can use Date.now().

It's important to note that Date.now() will return the number of milliseconds since January, 1 1970 UTC. If you need the number of seconds, you'll need to divide the result by 1000.

function getTimestampInSeconds () {
return Math.floor(Date.now() / 1000)
}

The Date class is full of all sorts of handy methods. If you're doing anything with dates in JavaScript, you'll want to use it. You can find the complete API here.