"Build a Responsive Website" was retired on September 11, 2014.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript and the DOM (Retiring) The Browser Environment The Browser Environment Review

Kevin Ohlsson
Kevin Ohlsson
4,559 Points

DOM & Document not the same?

Hello

In the review section the following question is asked

Quiz Question 3 of 5
The ___ is a representation of the document that JavaScript uses to navigate and make changes to a webpage.

the correct answer is DOM (Document Object Model)

I am confused. It seems to me as if the question is hinting that the DOM is a representation of the document.

Is the DOM and the document not the same thing?

1 Answer

Balazs Peak
Balazs Peak
46,160 Points

The DOM is the correct answer.

The DOM and the document are not the same thing programatically, but you can think of it like that. Just keep in mind that the document which is downloaded to the client, and showed in the browser, is represented in the JavaScript code by the DOM - hence the name, Document Object Model.

JavaScript is a programming language, those usually treat different pieces of data and resources as variables or objects. The JavaScript compiler needs an object which represents the document, in order to work with it. It can not access the document directly, there has to be a way, a pipeline, an API, whatever you want to call it.