The unary operator is +used to convert an object to a number, calling valueOf()from this object. If the number is not returned, the operation returnsNaN
You can customize this by editing the function valueOffor any object, for example:
var foo = {};
foo.valueOf = function () { return 9001; };
console.log(+foo);
Date valueOf()just returns getTime()( according to Mozilla )
source
share