DEV Community

Cover image for Javascript DOM vs BOM!
Alish Giri
Alish Giri

Posted on

4 1

Javascript DOM vs BOM!

DOM

DOM stands for Document Object Model and represents the web page. This allows programs to manipulate the document structure, style, and content.

const listDiv = document.getElementById("list-div");

listDiv.classList.add('new-class');
listDiv.classList.remove('new-class');
Enter fullscreen mode Exit fullscreen mode

BOM

BOM stands for Browser Object Model and represents the browser's window. This allows programs to access browsers functionalities. BOM is like the big container which contains DOM and all other javascript stuff.

// DOM is part of BOM.
window.document.getElementById("list-div");

window.innerHeight
window.location.href
window.alert("some-text");
Enter fullscreen mode Exit fullscreen mode

Top comments (6)

Collapse
 
77pintu profile image
77pintu

Thanks for the great post

Collapse
 
stevediaz profile image
stevediaz

Nice Read !

Collapse
 
melvin_ukaibe_b744fb16de4 profile image
Melvin Ukaibe

Wow. Thanks for sharing

Collapse
 
wootcot profile image
Alish Giri

You are welcome Melvin!

Collapse
 
davidthaddeus profile image
David Thaddeus

This is a great read. Thanks for sharing Alish

Collapse
 
wootcot profile image
Alish Giri

You are welcome David!

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay