title: javascript: Is is possible to assign a value to 'undefined'? (a question from You-Dont-know JS)
body: <p>Reading You-dont-know-Js at this chapter: <a href="https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch3.md" rel="nofollow noreferrer">https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch3.md</a></p>
  
  <p>there's a code snippet:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>undefined = true; // setting a land-mine for other code! avoid!
  
  (function IIFE( undefined ){
  
   var a;
   if (a === undefined) {
    console.log( "Undefined is safe here!" );
   }
  
  })();</code></pre>
  </div>
  </div>
  </p>
  
  <p>as for the immediately executed function, I know that the argument is undefined, a is also undefined, thus a===undefined.</p>
  
  <p>my question is that, how is it possible to assign a value to undefined?
   As I understand, undefined is a primitive type in js, then what is the meaning of undefined = true;?</p>
  
  <p>Additionally, to test my understanding, I changed this code a little:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>undefined = 5; // set undefined to an integer? how can it be?
  
  (function IIFE( undefined ){
  
   var a;
   if (a === undefined) {
    console.log( "Undefined is safe here!" );
   }
  
  })(undefined);  //still execute console.log function</code></pre>
  </div>
  </div>
  </p>
  
  <p>and the result remains same</p>