Skip to content

Instantly share code, notes, and snippets.

@stagas
Created April 5, 2011 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stagas/904705 to your computer and use it in GitHub Desktop.
Save stagas/904705 to your computer and use it in GitHub Desktop.
with undefined foo test
var locals = {}
var err
do {
err = undefined
try {
with(locals) {
foo
bar
kewl
console.log('all ok')
}
} catch(e) {
err = e
if (err.type === 'not_defined') {
locals[err.arguments[0]] = undefined
}
}
} while(err && err.type === 'not_defined')
console.log('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment