3 ms·
There's an easy way to fix that, though: function Foo(){ if (this == window) throw "USE NEW!"; // continue with object creation } Or use the stand
by Groxx 16y ago
There's an easy way to fix that, though:
function Foo(){
if (this == window) throw "USE NEW!";
// continue with object creation
}
Or use the standard practice of having class-creating function names capitalized, and let people know to follow it.