0

Some questions regarding the DOM and what it exactly is.

When I access document via console.dir I get all the properties of document like this:

DOM javascript

When I do a console.log I get something which looks more like the DOM:

DOM javascript

Questions:

  1. In my understanding the second object which we get from console.log() is the DOM. and the one from console.dir() is the DOM and all the Javascript properties which exists on the DOM. Is this correct?
  2. Is the DOM is a Javascript object?
  3. Can we access the DOM structure of element nodes which we get from console.log(window.document) from a property of console.dir(window.document)?
Willem van der Veen
  • 33,665
  • 16
  • 190
  • 155
  • Have look at the link: https://stackoverflow.com/questions/11954152/whats-the-difference-between-console-dir-and-console-log – Mamun Nov 21 '17 at 00:36
  • Is it a js object. No. I mentioned that it wasn't yesterday when you were asking about logging document and someone else stated it was which is incorrect. Link in answer below clarifies this – charlietfl Nov 21 '17 at 00:45
  • Yes thanks for the clarification because I was kinda confused – Willem van der Veen Nov 21 '17 at 00:46

1 Answers1

1

The DOM (Document Object Model) is a generic term for a set of objects.

document is a DOM object; you're just seeing two different ways of representing it.

You can access the DOM hierarchy via properties like .children.

For more information, see the documentation.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964