๐ Introduction to Window, BOM, and DOM in JavaScript
๐๐ช๐ณWindow, BOM, and DOM in JavaScript
In JavaScript, window, BOM (Browser Object Model), and DOM (Document Object Model) are distinct but related concepts, all playing a crucial role in web development. window object.
1๏ธโฃ Big Picture (Hierarchy)
- ๐ช Window : The global container object in the browser that holds everything (BOM + DOM)
- ๐ BOM (Browser Object Model) : The browser environment (history, location, navigator, screenโฆ) โ Represents the browser environment around the page.
- ๐ณDOM (Document Object Model) : The structured representation of the webpage (HTML) โ Represents the page content (HTML).
Hierarchy :
๐ชWindow
โณ ๐BOM (browser features: navigator, screen, location, history, document)
โณ ๐ณDOM (page structure, HTML content via document)
In summary, the window object is the top-level object in the browser environment. The BOM extends the window object to provide control over the browser itself, while the DOM is a subset of the BOM (accessed via window.document) that specifically deals with the content and structure of the web page.
Window โ BOM + DOM
- Window ๐ช = The global container object.
- BOM ๐ = Part of the Window, represents the browser environment (
navigator,location,history,screen). - DOM ๐ณ = Also part of the Window, represents the web page content (
document).
So the proper way to describe it is:
Window โ BOM
Window โ DOM
Interconnections Between Window, DOM & BOM
๐น Window โ The parent of everything.
๐น BOM โ Browser control system inside the Window.
๐น DOM โ Webpage structure inside the Window.
๐น Both BOM and DOM are accessible via Window, but they serve different roles โ
BOM for browser features ๐งญ, and DOM for page manipulation ๐งฑ.
Understanding the difference between them is essential to becoming a skilled JavaScript developer.


4 comments