The BOM and the DOM

Hey ,

I'm thrilled to help you learn JavaScript. Unfortunately, you've landed on a page where you cannot access with your current purchase.

Please upgrade (use this link) access this content.

I'm super eager to help you learn more!

The BOM and the DOM

BOM stands for Browser Object Model while DOM stands for Document Object Model.

BOM

BOM refers to the set of JavaScript objects browsers provide you with. It gives you the window object in JavaScript. If you open up your inspector and write console.log(window), you’ll see the list of every JavaScript method you can use.

A list of methods exposed through the Window Object
A list of methods exposed through the Window Object

As you can see, there’s a lot we can do with JavaScript. We’ll cover the most important ones you need to know as you proceed through the course. For now, let’s move on with this lesson.

You can use any property within the window object by typing window.propertyName or simply just propertyName. So, the following two are equivalent:

window.document
document

DOM

DOM refers to your HTML in JavaScript. Open up your inspector, click on the “Elements” tab and you’ll see the DOM.

The Elements tab contains the DOM
The Elements tab contains the DOM

You can access it with document.

The Document is an Element
The Document is an Element

You’ll use the DOM a lot in the next few lessons to come.

Exercise

Try to get the DOM with document. Log it out with your console. Click on the arrows in the results of that log to explore your DOM.

Answers

console.log(document)