Skip to content
Advertisement

Display Javascript Object In WebPage Without Knowing Its structure

I want to Display javascript document object in webpage, in the same way it is displayed in console as object opening as dropdown. Is there any way by which we can display a javascript object on webpage without knowing its structure in the same way as console does?

Advertisement

Answer

Check this out:

<html>
<head>
    <script type="text/javascript">
        for(var prop in document)
            document.write(prop + ' = ' + document[prop] + '<br>');
    </script>
</head>
<body></body>
</html>
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement