In What Is an API, and What Are Web APIs? and What Is the DOM, and How Do You Access Elements?, the teacher said
APIs establish a set of rules and protocols that allow software applications to communicate with each other and exchange data efficiently.
DOM stands for Document Object Model. It’s a programming interface that lets us interact with HTML documents.
However, I’m still confused about which applications DOM API helps to communicate. Is the description below correct?
For instance, A weather app uses an API to obtain local weather data from a weather website.
A HTML document (webpage) that uses DOM methods in JavaScript files to manipulate page elements is equivalent to a weather app; the DOM methods in JavaScript files play the role of API; and the browser is equivalent to a weather website that provides data - only here, the browser changes the DOM structure.