Chapter - 6 DOM & Async Await
Chapter - 6 DOM & Async Await
3 Essential Properties
Key properties include document.title,
document.URL, document.body, and
document.head.
Interacting with the DOM
Accessing Elements Powerful Selectors Dynamic Modification
2. What is await?
• await is a keyword used inside async functions.
• It makes JavaScript wait until the promise (an operation that takes time) is done, without blocking
the whole program.
3. What is fetch?
• The fetch function in JavaScript is used to make HTTP requests to web servers and handle responses.
Why Use async and await?
Imagine you are cooking a meal:
• While the pasta is boiling (a time-consuming task), you can chop vegetables (another task).
• Instead of standing there doing nothing while the pasta boils, you are being efficient by doing
other tasks.
Similarly, async and await let your code be efficient by not waiting around for one task to finish before
starting another.
API
(Application programming
Interface)
An API is like a waiter in a restaurant. It takes your request, delivers it to the
appropriate system (like the kitchen), and then brings back the information or service
you asked for. APIs allow different software systems to work together seamlessly and
efficiently