π 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