Hi everyone!!! I completed the last task of this problems and need feedback, is it correct this way? What could I have done better?, thanks for the time .
1 Like
Your code works correctly. Unfortunately you missed one requirement of the task:
you need to set an event listener on the
<button>
sβ parent element
The idea of this task is to only have one event listener on the button bar. Something like this:
function setColor(e) {
/* You can achieve the goal with one line of code in here */
}
buttonBar.addEventListener('click', setColor);
This concept is called event delegation. To get an idea what to do, have a look at the example on this page:
For another example I recommend this article from David Walsh:
Do you get the idea? Feel free to ask again if you need more help.
Happy Coding!
Michael
1 Like
Hi @mikoMK, youβre right i have to refactor my code, thanks for the info .
1 Like