Hacker News new | ask | show | jobs
by Groxx 5585 days 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.