JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

JavaScript

/* If foo gets initialized it works.  */
var foo=undefined;  //Even with an undefined value!

/* CLOSURE */
(function() {
  console.log("Inside closure 1"); //does  work
}(foo));


//var foo2 is undefined

/* CLOSURE2 */
(function() {
  console.log("Inside closure 2"); //does not work
}(foo2));



console.log("Code after closure 2. "); //does not work. script is stopped.