I'm currently studying javascript by following the book series "you dont know js".
In the book, section "scope & closure", where the author is discussing "IIFE", the author mentioned
Another application of this pattern addresses the (minor niche) concern that the default undefined identifier might have its value incorrectly overwritten, causing unexpected results. By naming a parameter undefined, but not passing any value for that argument, we can guarantee that the undefined identifier is in fact the undefined value in a block of 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!" ); } })();
But I thought undefined is a non-writable variable. And when I tried undefined = true; in chrome browser, the value of undefined indeed did not change (i.e. the assignment failed silently under non-strict mode). So why is the author trying to assign to undefined ?
And secondly, I'm not really sure what is the purpose of IIFE function with undefined as its parameter? Like what are some of the potential uses?