加号在“+新日期”中的作用
2022-08-30 00:33:31
这就是一元运算符。它等效于:+
function(){ return Number(new Date); }
JavaScript是松散类型的,因此在某些情况下它会执行类型强制/转换:
http://blog.jeremymartin.name/2008/03/understanding-loose-typing-in.html http://www.jibbering.com/faq/faq_notes/type_convert.html
其他示例:
>>> +new Date()
1224589625406
>>> +"3"
3
>>> +true
1
>>> 3 == "3"
true