Slight optimization: use Date.now() instead of (new Date()).getTime().
This avoid creating a new date object that is discarded immediately.