new Date() :
new Date()是创建Date对象:
var nowDate = new Date()
console.log('nowDate:', nowDate);
打印输出:
Date.now():
Date.now()是javascript中的内置函数,它返回自1970年1月1日00:00:00 UTC以来经过的毫秒数。因为now()是Date对象的静态方法,所以它将始终用作date.now()。
var end = Date.now()
console.log('end:', end);
打印输出: