时间戳
- Date 对象是基于1970年1月1日(世界标准时间)起的毫秒数
- 现在的时间距离1970年1月1日总的毫秒数(独一无二)
有三种方法实现
// 第一种 通过valueOf() getTime()
var date = new Date();
console.log(date.valueOf());
console.log(date.getTime());
// 第二种通过+new Date
var date1 = +new Date();
console.log(date1);
// 第三种 H5新增
console.log(Date.now());