Get current Unix timestamp in JavaScript

Math.round(new Date().getTime() / 1000)

source