Check if undefined with typeof - Javascript Data Type

Javascript examples for Data Type:undefined

Description

Check if undefined with typeof

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 w  ww  .j a v a2  s .c o m
function isDef(obj) {
        var undefined;
        return !obj === undefined;
}
var x;
function print(x) {
    document.body.innerHTML += "<p>" + x + "</p>";
};
print(isDef(x));
    }

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

Related Tutorials