Interview Question

What is the DOM?

The DOM is the script-accessible object tree of a document.

💡 Concept ✅ Quick Revision ⚡ JavaScript

Answer

The DOM is a tree-based object model for documents. • A Document represents the document and nodes represent its contents. • DOM methods let scripts query, create, change, and remove nodes. • The DOM is a web-platform API, not part of the ECMAScript language.

Example

Code
const heading = document.querySelector('h1');
heading.textContent = 'Updated';

Quick Revision

The DOM is the script-accessible object tree of a document.