Create a class (component) lamp, which consists of a switch and the lamp itself, when you click on the lamp button on / off
button.onclick = function() { document.body.style.backgroundColor = ('green'); }; .circle{ height: 40px; width: 40px; border: solid black 2px; border-radius: 40px; } <input type="button" id="button" value="Кнопка" /> <div class="circle"></div> It turns out to change only the background color of the page itself
