Check availability of a variable - Javascript Data Type

Javascript examples for Data Type:undefined

Description

Check availability of a variable

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Phantest</title> 
   </head> 
   <body> 
      <main> 
         <h1>test test Test</h1> 
         <p>Test of test test test</p> 
      </main> 
      <script>
        (function () {/*from w w w  .j  ava 2 s.  c o m*/
            console.log("Hello");
            setInterval(function () {
                if (window.myVar) {
                    console.log(window.myVar);
                }
            }, 1000);
        }());
    
      </script>  
   </body>
</html>

Related Tutorials