Photo by Joost Crop on Unsplash

13 Steps to become a JavaScript Pro. Step 2: Understanding the DOM

Vincenzo Bifano

--

Mastering the Document Object Model (DOM): A Crucial Step on Your Journey to JavaScript Mastery.

JavaScript is a popular programming language used to create dynamic and interactive websites. To become proficient in JavaScript, there are several topics to delve into, which this series aims to cover in a non-exhaustive way as a starting point for learning and improving.

Step 1, The Fundamentals is here.

The Document Object Model (DOM) is the programming interface for web documents. It is a tree-like structure that represents the HTML or XML document as a collection of nodes, with each node representing a part of the document, such as an element, attribute, or text. Learning how to access and manipulate the DOM with JavaScript is a fundamental skill for any web developer.

Topics to explore include:

  1. DOM Basics: Understand the basic structure of the DOM, including the document object, nodes, elements, attributes, and text.
  2. DOM Manipulation: Learn how to manipulate the DOM using JavaScript, including creating, modifying, and deleting elements and attributes.
  3. Event Handling: Events occur when a user interacts with a web page, such as clicking a button or scrolling. Learn how to handle these events with JavaScript and how to attach event listeners to elements in the DOM.
  4. Traversing the DOM: Learn how to traverse the DOM tree using methods like parentNode, childNodes, and nextSibling, and how to search for elements using methods like getElementById, getElementsByClassName, and querySelector.
  5. Performance Optimization: Manipulating the DOM can be resource-intensive, so it’s important to optimize your code for performance. Learn best practices for working with the DOM, including minimizing DOM updates and using delegation to handle events.

Here are 5 useful links:

  1. MDN Web Docs — Document Object Model (DOM): https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model
  2. W3Schools — JavaScript and the DOM: https://www.w3schools.com/js/js_htmldom.asp
  3. JavaScript.info — Browser: Document, Events, Interfaces: https://javascript.info/document
  4. SitePoint — An Overview of the Document Object Model: https://www.sitepoint.com/dom-document-object-model/
  5. DigitalOcean — Understanding the DOM: https://www.digitalocean.com/community/tutorials/introduction-to-the-dom

Here are 5 recommended books:

  1. DOM Enlightenment by Cody Lindley: https://domenlightenment.com/
  2. Learning the DOM by Jonathan Chaffer and Karl Swedberg: https://www.oreilly.com/library/view/learning-jquery-third/9781449330091/ch11.html
  3. JavaScript and JQuery: Interactive Front-End Web Development by Jon Duckett: https://www.amazon.com/JavaScript-JQuery-Interactive-Front-End-Development/dp/1118531647
  4. Professional JavaScript for Web Developers by Nicholas C. Zakas: https://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1119366445
  5. Eloquent JavaScript: A Modern Introduction to Programming by Marijn Haverbeke: https://eloquentjavascript.net/

Note: If you make a purchase by clicking on the links I have provided, as an Amazon Associate I earn from qualifying purchases.

Go to Step 3: Arrays and Objects

--

--

Vincenzo Bifano

Husband and father of two rough guys. Grace addicted. Senior Software Architect at Rai Radiotelevisione Italiana. I'm still in beta.