Async / Await in JavaScript Quiz – 15 Questions with Answers
15 questions · 12 min · Medium
Test your knowledge of DOM manipulation in JavaScript, including selecting elements, changing content and styles, creating elements, handling events, and modifying the document structure.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
15 questions · 12 min · Medium
15 questions · 12 min · Medium
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
A. Document Object Model
DOM stands for Document Object Model. It represents an HTML document as a tree of objects that JavaScript can interact with.
A. document.getElementById()
getElementById() returns the element whose id attribute matches the supplied string.
A. querySelector()
querySelector() returns the first element in the document that matches the specified CSS selector.
B. querySelectorAll()
querySelectorAll() returns a static NodeList containing all elements that match the specified CSS selector.
A. innerHTML
The innerHTML property gets or sets the HTML markup contained within an element.
A. textContent
textContent gets or sets the text content of an element and its descendants.
A. style
The style property provides access to an element's inline CSS styles, such as element.style.color.
A. document.createElement()
document.createElement() creates a new element node of the specified element type.
A. appendChild()
appendChild() adds a node as the last child of a specified parent node.
A. removeChild()
removeChild() removes a specified child node from its parent node.
A. addEventListener()
addEventListener() registers a function to be called when a specified event occurs on an element.
B. Changes the text content of the element with ID title
querySelector('#title') selects the element with the ID title, and textContent replaces its text content with Hello.
A. classList
classList provides methods such as add(), remove(), toggle(), and contains() for manipulating an element's CSS classes.
A. setAttribute()
setAttribute() sets the value of the specified attribute on an HTML element.
A. click
The click event is dispatched when the user clicks an element, and it can be handled using addEventListener('click', handler).