I have read the this question on SO, but here I am asking why the below semantics are allowed
Take the following Javascript example:
window - window = NaN
window - document = NaN
but
new Date() - new Date() = 0
new Date / new Date() = 1
new Date * new Date() = 2.2659874948410516e+24
Why does this work ? These code snippets were executed in Chrome console and I have a couple of questions about what is happening here:
Firstly, why is it even allowed in Javascript to do arithmetic operations on Date ? Is it a special type of object that is magically allowed these abilities ? Is Date even treated internally as an object ? Why then even force us to create a Date() like a normal object ?
Secondly, what does it even mean to subtract, or multiply two dates ?
Thirdly, is Date the only exception or are there other object that have these "superpowers"(other than string), also can they be replicated in user-defined code ?