Improve the solution

This commit is contained in:
Ryan Sobol 2016-11-11 06:53:23 -08:00
parent ba764541e2
commit 2ac097d1ac

View File

@ -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;