Explain the concepts of event bubbling and event capturing in the context of the DOM.
- Event capturing involves the outermost element to the target element, while event bubbling is the reverse.
- During event handling, the event travels through these phases.
- You can use
addEventListenerwith the third parameter astruefor capturing andfalse(default) for bubbling.