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

element that displays Total tax: 4.99.

B) It creates a

element that displays Total tax: 4.99 and adds it to the end of the

element.

C) It creates a

element that displays Total tax: 4.99 and adds it to the end of the

element.

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!