I have to change the color of list items using array colors.
Elements to modify.
<ul class="list">
<li class="list__item">1</li>
<li class="list__item">2</li>
<li class="list__item">3</li>
</ul>
const colorArray = ["red", "yellow", "blue"];
I've tried to loop through list__items and then loop through colorArray and match item[currIndex].style.backgroundColor = colorArray[index] but every time got err.
If anyone can give me advice on how to solve it I will appreciate it.
<ul class="list">
<li class="list__item">1</li> <!-- color red-- >
<li class="list__item">2</li><!-- color yellow-- >
<li class="list__item">3</li><!-- color blue-- >
</ul>`