Code snippet - defining a local undefined in JavaScript
Although already introduced features of ECMAScript5 fix this, the global property undefined in older versions of JavaScript is writable just like any other property. This means someone can override it which can cause trouble in a shared environment where everyone assumes its value.
This creates a locally scoped variable undefined that has the value of undefined (more on the type, value and variable undefined here). This way your code does not rely on the “fragile” global undefined and is more robust. More info: