I wrote a little vanilla JavaScript program, but I want to know if there is a possibility to write this simpler? With ES6+? But only with vanila JavaScript, no jQuery or other libraries / frameworks. Thanks in advance for the suggested solutions.
const red = document.getElementById('circleOne');
const green = document.getElementById('circleTwo');
const blue = document.getElementById('circleThree');
red.addEventListener("mouseover", () => {
red.style.backgroundColor = "red";
});
red.addEventListener("mouseout", () => {
red.style.backgroundColor = "white";
});
green.addEventListener("mouseover", () => {
green.style.backgroundColor = "green";
red.style.backgroundColor = "green"; …Run Code Online (Sandbox Code Playgroud)