<!DOCTYPE html>
<html>
<body>
<ul>
<li> Hello </li>
<li> Hello </li>
<li> Hello </li>
<li> Hello </li>
<li> Hello rumman </li>
</ul>
</body>
</html>
<!- Script Code -->
<script>
let elementLi = document.getElementsByTagName('li');
Array.from(elementLi).forEach(element =>{
console.log(elementLi);
element.style.color = 'blue';
element.style.boxShadow = '2px 5px #888888';
element.style.border = '1px solid';
element.style.padding = '10px';
});
</script>
Copy above code and run it in your environment to see the output.
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.