Important Question And Answer
DOM Means The Document Object Model.It is a programming interface for web documents. It Is RePresents The pages So That progrram can change the document structure, style, and content. The DOM represents the document as nodes and objects; that way, programming languages can interact with the page.
There Are 5 Ways in which you can select elements in a DOM using selectors.
1:getElementsByTagName()
2:getElementsByClassName()
3:getElementById()
4:querySelector()
5:querySelectorAll()
Event bubbling is a type of DOM event propagation where the event first triggers on the innermost target element, and then successively triggers on the ancestors of the target element in the same nesting hierarchy till it reaches the outermost DOM element or document object.
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
function greeting(name) {
alert(`Hello, ${name}`);
}
function processUserInput(callback) {
const name = prompt("Please enter your name.");
callback(name);
}
processUserInput(greeting);