Question: Consider the following given JavaScript statements: var colors = [ mauve , periwinkle , silver , cherry , lemon ]; var target = document .querySelector(
Consider the following given JavaScript statements: var colors = ["mauve", "periwinkle", "silver", "cherry", "lemon"]; var target = document.querySelector("ul");
Provide the JavaScript code to loop through the array and create a new "li" element containing each element, then insert the newly created "li" element to the target element.
Note: You must use only the built-in DOM functions to create all nodes and attach them to the DOM tree.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
