When you develop a web application is good practice don't mix the presentation with the logic. In our case, the HTML contains the presentation while the JS file contains the logic. When we add events in the HTML file we're adding logic to the presentation layer. For this motive, is a good practice to move the events to the JS file. This video shows how you can get to this goal. When you change your code, you must be careful to avoid the error "uncaught type error cannot read property 'addeventlistener' of null".
На этой странице сайта вы можете посмотреть видео онлайн JavaScript - Separation of logic layer code from the presentation layer. Using addEventListener длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Miquel Boada Artigas 11 Август 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 187 раз и оно понравилось 2 зрителям. Приятного просмотра!