I need a constructor that shouldn't be called as a function:
function Foo() {
...
};
var f = new Foo(); // ok
Foo(); // throws error
Searched in here and found that maybe I can use following to check if it is called as a function
if (!(this instanceof arguments.callee))
If so then what error should I throw?
And, is there any better way to define a constructor?