Question
Assume that the following $() function is available: const $ = selector => document.querySelector(selector); What does the following code do?: const p = document.createElement(p); const
Assume that the following $() function is available: const $ = selector => document.querySelector(selector); What does the following code do?: const p = document.createElement("p"); const ptext = document.createTextNode("Total tax: 4.99"); p.appendChild(ptext); const main = $("main"); main.appendChild(p);
A) It creates a
B) It creates a element. C) It creates a element that displays Total tax: 4.99 and adds it to the end of the D) It creates a element that displays Total tax: 4.99 but it doesnt add that element to the DOM.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started