Putting a single "use strict"; line at the top of a source file or function will turn on ECMAScript 5 strict mode for that scope, which will error on assigning a previously undeclared variable. I'm not sure if any browsers currently implement this though.