function Foo() {
if (! (this instanceof Foo)) {
throw "Attempted to call a constructor as a function. " +
"Must use 'new' eg 'new Foo()'.";
}
// ...
}
Gives an explanation on console and stops unintended behaviour before it happens.