What does the plus sign do in '+new Date'

That's the + unary operator. It's equivalent to:

function(){ return Number(new Date); }

See http://xkr.us/articles/javascript/unary-add and MDN.


A JavaScript date can be written as a string:

Thu Sep 10 2015 12:02:54 GMT+0530 (IST)

or as a number:

1441866774938

Dates written as numbers, specifies the number of milliseconds since January 1, 1970, 00:00:00.

Coming to your question it seams that by adding '+' after assignment operator '=' , converting Date to equal number value.

same can be achieve using Number() function, like Number(new Date());

var date = +new Date(); //same as 'var date =number(new Date());'

JavaScript is loosely typed, so it performs type coercion/conversion in certain circumstances:

http://blog.jeremymartin.name/2008/03/understanding-loose-typing-in.html
http://www.jibbering.com/faq/faq_notes/type_convert.html

Other examples:

>>> +new Date()
1224589625406
>>> +"3"
3
>>> +true
1
>>> 3 == "3"
true