Improve the solution
This commit is contained in:
parent
ba764541e2
commit
2ac097d1ac
4
index.js
4
index.js
@ -9,8 +9,6 @@
|
||||
const slowLight = document.querySelector('#slowLight');
|
||||
const goLight = document.querySelector('#goLight');
|
||||
|
||||
const controls = document.querySelector('#controls');
|
||||
|
||||
// part 1
|
||||
stopButton.addEventListener('click', () => {
|
||||
const color = stopLight.style.backgroundColor === 'red' ? '' : 'red';
|
||||
@ -48,6 +46,8 @@
|
||||
goButton.addEventListener('mouseleave', handleMouseLeave);
|
||||
|
||||
// bonus
|
||||
const controls = document.querySelector('#controls');
|
||||
|
||||
controls.addEventListener('click', (event) => {
|
||||
if (event.target === controls) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user