public
Last active

Redefine undefined outside the scope

  • Download Gist
fiddle.html
HTML
1 2
<p>First, undefined is defined to <em id="step1"></em></p>
<p>Then, undefined is redefined to <em id="step2"></em></p>
fiddle.js
JavaScript
1 2 3 4 5 6 7
$(document).ready(function() {
undefined = false;
$("#step1").text();
/* We create a self-invoking function to refefine undefined to undefined */
(function() { window.undefined = undefined })();
$("#step2").text(undefined);
});
fiddle.manifest
1
normalize_css: no

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.