So I've noticed that the result of
(new Date())
is a Date object; in this case
Date {Thu Dec 04 2014 22:43:07 GMT+0200 (SAST)}
but if I type
+(new Date())
I get an int value;
1417725787989
How is this done?
I have a function called 'Duration' which, when used like this:
new Duration(352510921)
returns an instance looking like this:
{ days:5, hours:3, mins:55, secs:10, ms:921 }
So how can I use the + operator to get the int value of the Duration instance?
var dur = new Duration(352510921);
console.log(+dur) // prints int value 352510921