var a = Date;
Object.defineProperty(window, "Date", { get: function() { console.log(this); return a; } });
(new Date);
Date();
How can I know, when Date is being called as a constructor(with "new"), and when it's being called as a function?
Update
these answers don't work for this case.
this
is always equal to a window