Using JavaScript write a boolean method that returns true if
Solution
<html>
 <head>  
    <script>
        var variable_name = 1;
        alert(getBoolean());
        function getBoolean()
        {
            if (typeof variable_name != \'undefined\')return true;
            else return false;
        }
    </script>
 </head>
 <body>
 </body>
 </html>
In order to search for a HTML element on page, following options can be used.
For example, to check whether a <div> with id=\"abc\" is rendered by the browser or not, following script can be used.
<html>
 <head>  
   
 </head>
 <body>
 <div id=\"abc\"></div>
<script>
        function getBoolean(arg)
        {
            if (document.getElementById(arg) !=null)
                alert(\'it exists!\');
           if (document.getElementById(arg) ==null)
                alert(\'does not exist!\');
       }
        getBoolean(\"abc\");
    </script>
 </body>
 </html>

