Using closures with Undefined value as input stops script - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Using closures with Undefined value as input stops script

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from www. ja  v a  2  s.  com
var undefined = 123
if(undefined){
   console.log("pass");
}
(function(undefined){
   console.log("inside closure");
   if(undefined){
      console.log("Didnt Pass")
   };
}());
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials