In a constructor object in JS if it's created without the new keyword the 'this' variable is a reference to the window instead of the object. Is this a particularly wise idea to try and detect that?
function MyObject ()
{
if (this === window) {
alert('[ERROR] Oopsy! You seem to have forgotten to use the "new" keyword.');
return;
}
// Continue with the constructor...
}
// Call the constructor without the new keyword
obj = MyObject()