.block {
background: #fff;
}
.color1 {
background: #000;
}
var block = document.querySelector('.block');
block.addEventListener('mouseenter', function () {
block.classList.add('color1');
});
block.addEventListener('mouseleave', function () {
block.classList.remove('color1');
});