Javascript DOM vs BOM!

alishgiri

Alish Giri

Posted on September 13, 2024

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
πŸ’– πŸ’ͺ πŸ™… 🚩
alishgiri
Alish Giri

Posted on September 13, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related