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
Get step-by-step solutions from verified subject matter experts
