Question: Confused on this one as well Rainbow Text Exercise . I've provided you with an chl> element which contains 7 individual spans (each holding a
Rainbow Text Exercise . I've provided you with an chl> element which contains 7 individual spans (each holding a single letter). Please write some JavaScript to make them rainbow-colored! In app.js you'll find an array of color names called colors. It looks like: l'red', 'orange', "yellow', 'green', 'blue', 'indigo', 'violet'l Your task is to select all spans, iterate over them, and assign them each one of the colors from the colors array. The first span should be red, the second should be orange, etc. Your result should look like this: RA N B OW ndex.html pp.js 1 const colors = ['red', 'orange', 'yellow', 'green' blue indigo violetta 2 03 const colo document.querySelector'span> 4 5. for(let col of colo) { 6 col.style.color='red'; 7)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
