JavaScript中可以在某个元素前使用 ‘+’ 号,这个操作是将该元素转换成Number类型,如果转换失败,那么将得到 NaN
+new Date() 将会调用 Date.prototype 上的 valueOf() 方法,根据MDN,Date.prototype.value方法等同于Date.prototype.getTime()
console.log(+new Date('2020-10-31'));
console.log(new Date('2020-10-31').getTime());
console.log(new Date('2020-10-31').valueOf());
console.log(new Date('2020-10-31') * 1);
// 结果都为 1604102400000