In older browsers where Date.now()
is unavailable, use (new Date()).getTime()
instead:
t = (new Date()).getTime();
Or, to provide a Date.now()
function for use in older browsers, use this polyfill:
if (!Date.now) {
Date.now = function now() {
return new Date().getTime();
};
}